[m-rev.] diff: workaround Github issue #103

Julien Fischer jfischer at opturion.com
Sat Jun 25 21:02:39 AEST 2022


Workaround Github issue #103.

The basic block vectorizer optimisation in GCC 11 and 12 is generating code
that causes segmentation faults in grades that use non-local gotos.
As a workaround, disable that optimisation for GCC 11 and later.
(While this problem has presumably always existed for GCC 11, it has not shown
up previously because the affected optimisation is only enabled at -O3; with
GCC 12 it is enabled by default. GCC 10 and earlier do not appear to be
affected.)

configure.ac:
      Add the above workaround.

Julien.

diff --git a/configure.ac b/configure.ac
index 26007c6..871cbe5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2422,6 +2422,18 @@ case "$ac_cv_c_compiler_gnu" in yes)
      ;;
  esac

+# GCC's basic block vectorizer produces code that is not compatible with
+# non-local gotos for GCC 11 and 12. We disable that optimisation for now.
+# (See Github issue #103 and Mantis issue #561.)
+case "$host" in x86_64*)
+    case $C_COMPILER_TYPE in
+        gcc_1[[1-9]]_*)
+            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fno-tree-slp-vectorize"
+            ;;
+    esac
+    ;;
+esac
+
  # Determine if $CFLAGS_FOR_NO_REORDER_FUNCTIONS is needed.
  case "$C_COMPILER_TYPE" in
      # Check if the option is not required, and otherwise include the option.


More information about the reviews mailing list