https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601

            Bug ID: 101601
           Summary: [12 Regression] -Wall is reported as a build error
                    (not warning): error: arrays of functions are not
                    meaningful
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

The example is extracted from wine-6.13 build failure against gcc-master.

Here is the smaller example:

$ cat a.c
    // x86_64-pc-linux-gnu-gcc -m32 -c -o a.o a.c -Wall -pipe -O2
    typedef void f(void);
    void args(void*);
    f *SSCall_fun;
    void SSCall(void) { args(&SSCall_fun + 1); }

$ ./xgcc -B.  -m32 -c -o a.o a.c -Wall -pipe -O2
a.c: In function 'SSCall':
a.c:5:6: error: arrays of functions are not meaningful
    5 | void SSCall(void) { args(&SSCall_fun + 1); }
      |      ^~~~~~

Note1: -Wall turns successful build into build failure.

I think it's not expected: it should still be a warning (or an unconditional
error).

$ ./xgcc -B.  -m32 -c -o a.o a.c -Wall -pipe
$ ./xgcc -B.  -m32 -c -o a.o a.c -pipe -O2
$ gcc-11.1.0  -m32 -c -o a.o a.c -Wall -pipe -O2

Note2: -O2 vs. -O0 causes warning to go away (maybe it's ok).

$ ./xgcc -B. -v
Reading specs from ./specs
COLLECT_GCC=./xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--enable-languages=c,c++ --disable-bootstrap --with-multilib-list=m64
--prefix=/tmp/gcc-build/../gcc-native-quick-installed --disable-nls
--without-isl --disable-libsanitizer --disable-libvtv --disable-libgomp
--disable-libstdcxx-pch --disable-libunwind-exceptions CFLAGS='-O1 '
CXXFLAGS='-O1 '
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210723 (experimental) (GCC)

Reply via email to