2024-04-26 09:42 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000294mercuryBugpublic2013-09-29 15:12
Reporterpbone 
Assigned Topbone 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
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
  • ? file icon patch (1,741 bytes) 2013-07-24 18:24 -
    diff --git a/configure.ac b/configure.ac
    index ec1a7b4..b732196 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -918,6 +918,18 @@ else
         CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS=
     fi
     
    +AC_MSG_CHECKING(whether we can use -fno-reorder-functions)
    +if $CC -fno-reorder-functions -c conftest.c \
    +    </dev/null >&AC_FD_CC 2>&1
    +then
    +    AC_MSG_RESULT(yes)
    +    #CFLAGS_FOR_NO_REORDER_FUNCTIONS="-fno-reorder-functions"
    +    CFLAGS_FOR_NO_REORDER_FUNCTIONS=""
    +else
    +    AC_MSG_RESULT(no)
    +    CFLAGS_FOR_NO_REORDER_FUNCTIONS=""
    +fi
    +
     rm -f conftest*
     
     #-----------------------------------------------------------------------------#
    @@ -2421,6 +2433,10 @@ AC_SUBST(MR_DARWIN_SETJMP_WORKAROUND)
     # For x86, x86-64 and possibly other architectures, when using non-local
     # gotos with gcc 4.x we need `-fno-move-loop-invariants'.
     #
    +# For x86-64 and possibly other architectures, when using non-local gotos
    +# and parallelism with gcc 4.6 and 4.7 (and possibly future versions), we
    +# need -fno-reorder-functions  We don't know why.
    +#
     # For alpha, mips, and ARM, and probably on other architectures, when using
     # non-local gotos we need -fomit-frame-pointer, otherwise when compiling
     # with --no-c-optimize we run into a problem similar to the one above:
    @@ -2451,7 +2467,9 @@ case "$ac_cv_prog_gcc" in yes)
                 CFLAGS_FOR_GOTOS="-fno-defer-pop -fno-function-cse -fno-gcse"
                 ;;
         esac
    -    CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS"
    +    CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS \
    +        $CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS \
    +        $CFLAGS_FOR_NO_REORDER_FUNCTIONS"
         case "$host" in
             mips-sgi-irix5.*)
                 # Non-local gotos don't work with shared libraries on Irix 5,
    
    ? file icon patch (1,741 bytes) 2013-07-24 18:24 +

-Relationships
+Relationships

-Notes

~0000556

pbone (administrator)

I have uploaded a patch that I started working on.

~0000558

juliensf (administrator)

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 (administrator)

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 (administrator)

Is this on x86_64, i686 or both? Also, is the test case also broken on reg.gc.steg?

~0000561

pbone (administrator)

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 (administrator)

I've now also tested asm_fast.gc.stseg, which does not have the bug.

~0000569

pbone (administrator)

Fixed in a8397086be733a27d73fe1b0f14b5aa92487adb4

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

-Issue History
Date Modified Username Field Change
2013-07-24 18:23 pbone New Issue
2013-07-24 18:24 pbone File Added: patch
2013-07-24 18:24 pbone Note Added: 0000556
2013-08-22 22:28 pbone Assigned To => pbone
2013-08-22 22:28 pbone Status new => assigned
2013-08-23 15:33 juliensf Note Added: 0000558
2013-09-01 14:43 pbone Note Added: 0000559
2013-09-01 16:07 juliensf Note Added: 0000560
2013-09-01 17:46 pbone Note Added: 0000561
2013-09-03 16:30 pbone Note Added: 0000563
2013-09-29 15:12 pbone Note Added: 0000569
2013-09-29 15:12 pbone Status assigned => resolved
2013-09-29 15:12 pbone Resolution open => fixed
+Issue History