https://bugs.kde.org/show_bug.cgi?id=511972

            Bug ID: 511972
           Summary: valgrind-3.26.0 tests fail to build on upcomig gcc-16:
                    unrecognized command-line option
                    '-Wno-alloc-size-larger-than=18446744073709551615'
    Classification: Developer tools
           Product: valgrind
      Version First 3.26 GIT
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY

gcc-16 added extra validation to `-Wno-` options comared to `-W` options in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5b276d38c2fdd7df3d167755940da2038e049308

As a result `-Walloc-size-larger-than=18446744073709551615` is not valid flag
while `-Wno-alloc-size-larger-than=18446744073709551615` is invalid and the
build fails as:

gcc -DHAVE_CONFIG_H -I. -I../..  -I../.. -I../../include -I../../coregrind
-I../../include -I../../VEX/pub -I../../VEX/pub -DVGA_amd64=1 -DVGO_linux=1
-DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1    -Winline -Wall -Wshadow
-Wno-long-long -g -fno-stack-protector   -m64 -Wno-unused-result
-Wno-alloc-size-larger-than=18446744073709551615  -MT bug155125-bug155125.o -MD
-MP -MF .deps/bug155125-bug155125.Tpo -c -o bug155125-bug155125.o `test -f
'bug155125.c' || echo './'`bug155125.c
gcc: error: unrecognized command-line option
'-Wno-alloc-size-larger-than=18446744073709551615'

STEPS TO REPRODUCE
1. install `gcc` from `master`
2. $ ./configure CC=gcc-16 CXX=g++-16
3. $ make check

OBSERVED RESULT

Build fails with `gcc: error: unrecognized command-line option
'-Wno-alloc-size-larger-than=18446744073709551615'`

EXPECTED RESULT

Build should succeed.

SOFTWARE/OS VERSIONS
compiler: gcc from master branch

ADDITIONAL INFORMATION

The bug happens because `configure.ac` only probes
`-Walloc-size-larger-than=18446744073709551615` option and assumes
`-Wno-alloc-size-larger-than=18446744073709551615` would work automatically:

>From configure.ac:

```
AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
  AC_MSG_CHECKING([if gcc accepts -W$1])
  safe_CFLAGS=$CFLAGS
  CFLAGS="-W$1 -Werror" dnl <---------------- probe -W ===============
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
  AC_SUBST([$2], [-Wno-$1])  dnl <---------------- assume -Wno- =========
  AC_MSG_RESULT([yes])], [
  AC_SUBST([$2], [])
  AC_MSG_RESULT([no])])
  CFLAGS=$safe_CFLAGS
])
...

AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=18446744073709551615],
[FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
```

It used to work until
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5b276d38c2fdd7df3d167755940da2038e049308

A simple workaround to check both forms of the flag restores the build for me:

```diff
--- a/configure.ac
+++ b/configure.ac
@@ -2538,7 +2538,7 @@ fi
 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
   AC_MSG_CHECKING([if gcc accepts -W$1])
   safe_CFLAGS=$CFLAGS
-  CFLAGS="-W$1 -Werror"
+  CFLAGS="-W$1 -Wno-$1 -Werror"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
   AC_SUBST([$2], [-Wno-$1])
   AC_MSG_RESULT([yes])], [
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to