| Anonymous | Login | Signup for a new account | 2013-05-22 01:18 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0004328 | OCaml | Camlp4 | public | 2007-06-23 03:42 | 2010-04-29 14:26 | |||
| Reporter | cstork | |||||||
| Assigned To | ertai | |||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.0 | |||||||
| Target Version | Fixed in Version | 3.10+dev | ||||||
| Summary | 0004328: Handling of nil nodes is suboptimal | |||||||
| Description | If I try to pretty print <:str_item< type $t$; ... >> where t could potentially be a nil node, ie, <:ctyp<>>, then camlp4r produces a stack overflow. Two suggestions: 1) CleanAst.ml could easily turn such empty str_item nodes into <:str_item<>>. Attached is a simple patch that achieves this for this case. If there's interest I'd extend this patch to cover more useful cases. This has the potential to make writing camlp4 extensions more pleasant. 2) camlp4 shouldn't simply crash on nil nodes, but produce a meaningful error message. In case that such a nil node is not pretty printed but dump'ed the error message is Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 792, char 11 which is a bit more helpful. | |||||||
| Additional Information | To reproduce: $ echo << DONE open Camlp4.PreCast.Syntax; EXTEND Gram GLOBAL: str_item; str_item: [[ "type_Nil" -> <:str_item< type $ <:ctyp<>> $ >> ]]; END; DONE > pa_type_Nil.ml $ ocamlc -c -pp camlp4rf -I +camlp4 pa_type_Nil.ml $ echo "type_Nil;" > type_Nil.ml $ camlp4r pa_type_Nil.cmo type_Nil.ml type (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((... Camlp4: Uncaught exception: Stack_overflow | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-06-23 03:42 | cstork | New Issue | |
| 2007-06-23 03:42 | cstork | File Added: CleanAst.patch | |
| 2007-11-10 15:10 | xleroy | Status | new => assigned |
| 2007-11-10 15:10 | xleroy | Assigned To | => ertai |
| 2007-11-21 17:29 | ertai | Note Added: 0004336 | |
| 2007-11-21 17:29 | ertai | Status | assigned => resolved |
| 2007-11-21 17:29 | ertai | Resolution | open => fixed |
| 2007-11-21 17:29 | ertai | Fixed in Version | => 3.10+dev |
| 2010-04-29 14:26 | xleroy | Status | resolved => closed |
| Copyright © 2000 - 2011 MantisBT Group |