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,
