|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000559||mercury||Bug||public||2022-05-03 16:12||2022-08-03 19:41|
|Target Version||Fixed in Version|
|Summary||0000559: Stack overflow in hlc.gc Mercury 22.01.1 compiler on Windows|
|Description||The attached module is derived from a stress test for the Zinc compiler. Compiling this with a Mercury 22.0.1 compiler built in the hlc.gc results in a stack overflow on Windows when reading the module. (The significance of Window is that the stack size is very small, even though IIRC we bump it up a bit.)|
(This is not a new problem, Mercury 20.01 also has the same problem.)
|Steps To Reproduce|
$ mmc -C zm_hug_flat_case.m
|Tags||No tags attached.|
I believe I have diagnosed the problem, though I cannot confirm it,
since I am not set up to program on Windows.
Compiling zm_huge_flat_case.m with a debug grade compiler under mdb,
the command "min_depth 10000" shows very deep mutual recursion in
parse_goal.m between parse_goal, parse_non_call_goal, and parse_goal_semicolon.
Basically, you need three stack frames for each disjunct in that big
disjunction, and the different determinisms (parse_non_call_goal is semidet,
the others are det) prevent both the MLDS and the LLDS code generator
from being able to do tail recursion.
I have an idea for a solution and will try it out tomorrow, but it may
add some overhead. Once I have an implementation ready, I will need you
to run some benchmarks to see whether it adds any overhead for run-of-the-mill,
non-extreme Mercury code, and if so, whether that overhead is significant.
|Last part of the fix committed 2022 may 7.|
|2022-05-03 16:12||juliensf||New Issue|
|2022-05-03 16:12||juliensf||File Added: zm_huge_flat_case.m.gz|
|2022-05-03 18:06||zs||Note Added: 0001194|
|2022-05-03 18:07||zs||Assigned To||=> zs|
|2022-05-03 18:07||zs||Status||new => assigned|
|2022-08-03 19:41||zs||Status||assigned => resolved|
|2022-08-03 19:41||zs||Resolution||open => fixed|
|2022-08-03 19:41||zs||Note Added: 0001201|