Mercury Bugs - mercury
View Issue Details
0000294mercuryBugpublic2013-07-24 18:232013-09-29 15:12
Reporterpbone 
Assigned Topbone 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000294: GCC 4.6 and 4.7 break asm_fast.par grades
DescriptionThe mandelbrot program crashes when compiled with gcc 4.6 or 4.7. I have not tested 4.8. 4.5 works.

I found that passing -fno-reorder-functions to GCC avoids the problem. I don't yet know why.
TagsNo tags attached.
Attached Files? patch (1,741) 2013-07-24 18:24
https://bugs.mercurylang.org/file_download.php?file_id=178&type=bug

Notes
(0000556)
pbone   
2013-07-24 18:24   
I have uploaded a patch that I started working on.
(0000558)
juliensf   
2013-08-23 15:33   
Hi Paul,

Some comments on your patch: in the configure script, you should be able to use the value of C_COMPILER_TYPE to tell whether to pass -fno-reorder-functions or not to the C compiler or not. (The value of that variable also encodes the version of the C compiler.)

For now I would suggest disabling the option for GCC version 4.6 and onwards.

This bug should be kept open until we know *why* -freorder-functions is breaking the .par grades.
(0000559)
pbone   
2013-09-01 14:43   
Notes on why this bug may be occurring:

The program has to use higher order code but doesn't need to contain a
parallel conjunction.

The effected grade has to be a low-level C par grade, I've only tested with
stack segments, so I don't know if disabling them will help. I tested a few
of the low-level C grades:

    asm_fast.gc: Works
    asm_fast.gc.par.seg: Broken
    asm_fast.gc.seg: Broken
    reg.gc.par.seg: Broken
    none.gc.par.seg: Works

So, the bug is independent of GC and parallel conjunction. It does require
higher order code, a parallel grade, and gcc global registers.
(0000560)
juliensf   
2013-09-01 16:07   
Is this on x86_64, i686 or both? Also, is the test case also broken on reg.gc.steg?
(0000561)
pbone   
2013-09-01 17:46   
x86_64, I havn't tested the others.

Also regarding reg.gc.par.stseg, this doesn't work in older versions of GCC 4.6 either, so there are at least two different bugs, and until I understand both of them I can't say if the "reg" grades are affected or not. So I can't tell if this is GCC global registers or some other option.
(0000563)
pbone   
2013-09-03 16:30   
I've now also tested asm_fast.gc.stseg, which does not have the bug.
(0000569)
pbone   
2013-09-29 15:12   
Fixed in a8397086be733a27d73fe1b0f14b5aa92487adb4

I'm leaving the bug open as we still do not know the cause.

Issue History
2013-07-24 18:23pboneNew Issue
2013-07-24 18:24pboneFile Added: patch
2013-07-24 18:24pboneNote Added: 0000556
2013-08-22 22:28pboneAssigned To => pbone
2013-08-22 22:28pboneStatusnew => assigned
2013-08-23 15:33juliensfNote Added: 0000558
2013-09-01 14:43pboneNote Added: 0000559
2013-09-01 16:07juliensfNote Added: 0000560
2013-09-01 17:46pboneNote Added: 0000561
2013-09-03 16:30pboneNote Added: 0000563
2013-09-29 15:12pboneNote Added: 0000569
2013-09-29 15:12pboneStatusassigned => resolved
2013-09-29 15:12pboneResolutionopen => fixed