|Anonymous | Login | Signup for a new account||2016-07-29 08:01 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006364||OCaml||OCaml backend (code generation)||public||2014-04-08 15:25||2014-06-05 16:31|
|Target Version||Fixed in Version|
|Summary||0006364: ocamlopt crashes with "Fatal error: exception Stack_overflow"|
|Description||The following file (too large to be hosted on Mantis) is a 5.4MB .ml file generated automatically:|
It consists of a few type definitions for an AST, and then a single, huge term (let defs starting on line 448). It is probably pathological, but here is what happens when I try and compile it anyway:
$ ocamlc.opt -c -o power.cmo gistfile1.ml
$ ocamlopt -c -o power.cmx gistfile1.ml
Fatal error: exception Stack_overflow
I get the same results with ocamlc.opt and ocamlopt.opt.
I'm not sure it's worth spending too many efforts fixing, but I figured it might help uncover some bug in ocamlopt.
|Tags||No tags attached.|
|Attached Files||gistfile1.ml.gz [^] (250,742 bytes) 2014-04-08 15:36|
|Attached compressed test file.|
The culprit seems to be non-tail recursion in the backend, in particular Compilenv.structured_constants, which uses List.map (and so could be easily fixed), and Comballoc.combine, which requires a bit more work.
In the meantime, you may be able to work around the issue with something like 'ulimit'. The following works for me:
$ ulimit -s 65536
$ ocamlopt.opt -c gistfile1.ml
I am marking this PR as "suspended" for the reasons given in 0005925, namely: making the native-code generator tail-recursive is a very invasive change, and supporting huge generated source files is a low priority.
|2014-04-08 15:25||kerneis||New Issue|
|2014-04-08 15:36||kerneis||File Added: gistfile1.ml.gz|
|2014-04-08 15:39||kerneis||Note Added: 0011246|
|2014-04-08 16:58||yallop||Note Added: 0011247|
|2014-05-30 11:05||shinwell||Status||new => acknowledged|
|2014-05-30 11:51||gasche||Relationship added||related to 0005626|
|2014-06-05 16:30||xleroy||Note Added: 0011680|
|2014-06-05 16:30||xleroy||Status||acknowledged => resolved|
|2014-06-05 16:30||xleroy||Resolution||open => suspended|
|2014-06-05 16:31||xleroy||Relationship added||related to 0005925|
|Copyright © 2000 - 2011 MantisBT Group|