View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000559 | mercury | Bug | public | 2022-05-03 16:12 | 2022-05-03 18:07 | ||||||||
Reporter | juliensf | ||||||||||||
Assigned To | zs | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | assigned | Resolution | open | ||||||||||
Product Version | |||||||||||||
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. | ||||||||||||
Attached Files |
|
![]() |
|
zs (developer) 2022-05-03 18:06 |
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. |