Mercury Bugs - mercury
View Issue Details
0000049mercuryBugpublic2008-02-28 18:362008-03-17 17:21
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000049: loop invariant hoisting causes MLDS backend to abort
DescriptionThe attached program causes the MLDS backend to abort when compiled in a hl or hlc grade
with:

mmc -C -O0 --common-struct --loop-invariants

The problem seems to be related to the fact that calls to array.init/1 are being incorrectly
hoisted (presumably because they arrays are not unique at the moment.)

The LLDS backend compiles this code down to what is invalid C code (at least on eris).

TagsNo tags attached.
Attached Files? colgen_dw.m (1,777) 2008-02-28 18:36
https://bugs.mercurylang.org/file_download.php?file_id=42&type=bug
? str_loopinv.m (2,913) 2008-03-05 17:17
https://bugs.mercurylang.org/file_download.php?file_id=45&type=bug

Notes
(0000084)
wangp   
2008-03-05 17:21   
I added a second test case which seems like it might be the same bug, only the abort happens with the LLDS backend.

  mmc -O0 --common-struct --inlining --loop-invariants str_loopinv.m

In str_loopinv.loop_inv_0__func__float_to_string_2__40__1 the non-local sets for the calls to str_loopinv.append_iio are wrong.

Also, both cases are fine with rotd-2008-01-19 so something was broken between then and now.
(0000085)
juliensf   
2008-03-05 17:29   
Actually the invalid C code problem on eris is a red herring. It's due to the asm_fast grades
not being supported on that platform.
(0000090)
wangp   
2008-03-17 17:21   
(Last edited: 2008-03-17 17:22)
I think the bug is somewhere in the stm change posted by zs on 25/02. The problem doesn't occur for the version retrieved with "cvs up -D 2008-02-27" but does for the version retrieved with "cvs up -D '2008-02-27 19:00'".

Or at least, that was when some previous problem was exposed.


Issue History
2008-02-28 18:36juliensfNew Issue
2008-02-28 18:36juliensfFile Added: colgen_dw.m
2008-03-05 17:17wangpFile Added: str_loopinv.m
2008-03-05 17:21wangpNote Added: 0000084
2008-03-05 17:29juliensfNote Added: 0000085
2008-03-17 17:21wangpNote Added: 0000090
2008-03-17 17:22wangpNote Edited: 0000090