[m-rev.] for post-commit review: fix github issue #102

Julien Fischer jfischer at opturion.com
Sat Jun 18 20:05:11 AEST 2022


For post-commit review by anyone.
(Mainly for the NEWS file entry.)

------------------------------------

Fix Github issue #102.

Avoid the use of the GCC option -Warray-bounds with GCC version 12 and later.

configure.ac:
scripts/mgnuc.in:
     As above.

NEWS:
     Announce the fix.

Julien.

diff --git a/NEWS b/NEWS
index d34398c..bd3f762 100644
--- a/NEWS
+++ b/NEWS
@@ -429,6 +429,11 @@ This is a bug-fix release.
    violations in the Mercury runtime on AArch64 systems with versions of
    GCC before 10.

+* [Github issue #102]. We have disabled the use of the GCC option
+  `-Warray-bounds` for GCC version 12 and onwards. This is due to GCC
+  emitting spurious warnings when that option is enabled.  (The use of
+  that option was already disabled for GCC versions 9-11.)
+
  NEWS for Mercury 22.01.1
  ========================

diff --git a/configure.ac b/configure.ac
index d6fee83..307fc84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4378,7 +4378,7 @@ case "$mercury_cv_cc_type" in
          # See scripts/mgnuc.in for an explanation of why we set
          # -Wno-array-bounds here.
          case "$C_COMPILER_TYPE" in
-            gcc_9_*|gcc_10_*|gcc_11_*)
+            gcc_9_*|gcc_1[0-9]_*)
                  CFLAGS_FOR_WARNINGS="$CFLAGS_FOR_WARNINGS -Wno-array-bounds"
              ;;
          esac
diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index f4eece5..649539e 100755
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -5,7 +5,7 @@
  # @configure_input@
  #---------------------------------------------------------------------------#
  # Copyright (C) 1995-2007, 2010-2012 The University of Melbourne.
-# Copyright (C) 2013-2020 The Mercury team.
+# Copyright (C) 2013-2020, 2022 The Mercury team.
  # This file may only be copied under the terms of the GNU General
  # Public License - see the file COPYING in the Mercury distribution.
  #---------------------------------------------------------------------------#
@@ -569,14 +569,16 @@ case "${FULLARCH}" in
          esac
          ;;
  esac
-
-# gcc versions 9, 10 and 11 replace calls to strcmp and related functions with
+# gcc versions 9-12 replace calls to strcmp and related functions with
  # specialised code when some of the arguments are string constants.
  # The above versions of gcc emit spurious warnings about the code they
  # introduce when -Warray-bounds is enabled.
+# We currently disable the warning for all versions of GCC > 8 since
+# the problem is not known to have been fixed in any later version (as of
+# 2022-06-18).
  #
  case "${C_COMPILER_TYPE}" in
-    gcc_9_*|gcc_10_*|gcc_11_*)
+    gcc_9_*|gcc_1[0-9]_*)
          CHECK_OPTS="${CHECK_OPTS} -Wno-array-bounds"
      ;;
  esac


More information about the reviews mailing list