[m-rev.] diff: alternative workaround for bug #307

Julien Fischer jfischer at opturion.com
Fri Jan 10 15:49:56 AEDT 2014

NOTE: I've bootstrapped the system in asm_fast.gc with GCC 4.8.2 and 
mercury_ho_call.c seems to be the only thing that causes internal errors 
in that verison of GCC.  I'll commit this change rather than the previous
workaround for this bug.


Workaround bug #307.

We encounter internal errors in GCC 4.8.2 on i686 Linux when compiling
runtime/mercury_ho_call.c in grades that use global registers when -fpic is
enabled.  Compile that module at -O0 in the above circumstances; doing so
avoids tickling the bug.

 	As above.


diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index affb55a..f3b42da 100644
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -603,6 +603,13 @@ case $COMPILER in gcc)
                  ARCH_OPTS="$ARCH_OPTS -O0" ;;
              *" display_report.c "*)
                  ARCH_OPTS="$ARCH_OPTS -O0" ;;
+            # Workaround for a internal compiler error with GCC 4.8
+            # in grades that use global registers.
+            *" mercury_ho_call.c "*)
+                case "$global_regs" in true)
+                    ARCH_OPTS="$ARCH_OPTS -O0" ;;
+                esac
+                ;;
              esac ;;
              case "$*" in

More information about the reviews mailing list