public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful
@ 2021-07-23 15:01 slyfox at gcc dot gnu.org
2021-07-23 15:10 ` [Bug middle-end/101601] " mpolacek at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-07-23 15:01 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/101601] [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
@ 2021-07-23 15:10 ` mpolacek at gcc dot gnu.org
2021-07-23 15:55 ` slyfox at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-23 15:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |middle-end
Last reconfirmed| |2021-07-23
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This comes from array_bounds_checker::check_array_bounds -> not a FE issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/101601] [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
2021-07-23 15:10 ` [Bug middle-end/101601] " mpolacek at gcc dot gnu.org
@ 2021-07-23 15:55 ` slyfox at gcc dot gnu.org
2021-07-23 17:27 ` [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers " msebor at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-07-23 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601
Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #2 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Bisected down to r12-2132 "Correct handling of variable offset minus constant
in -Warray-bounds [PR100137]"
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers error: arrays of functions are not meaningful
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
2021-07-23 15:10 ` [Bug middle-end/101601] " mpolacek at gcc dot gnu.org
2021-07-23 15:55 ` slyfox at gcc dot gnu.org
@ 2021-07-23 17:27 ` msebor at gcc dot gnu.org
2021-07-28 22:16 ` cvs-commit at gcc dot gnu.org
2021-07-28 22:17 ` msebor at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-23 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
Status|NEW |ASSIGNED
Keywords| |diagnostic
Target Milestone|--- |12.0
Summary|[12 Regression] -Wall is |[12 Regression]
|reported as a build error |-Warray-bounds triggers
|(not warning): error: |error: arrays of functions
|arrays of functions are not |are not meaningful
|meaningful |
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
-Warray-bounds triggers the error while formatting the type of SSCall_fun. For
simplicity, it converts the type of each singleton object into a one-element
array of its type, but the code is wrong for function pointers.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers error: arrays of functions are not meaningful
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2021-07-23 17:27 ` [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers " msebor at gcc dot gnu.org
@ 2021-07-28 22:16 ` cvs-commit at gcc dot gnu.org
2021-07-28 22:17 ` msebor at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:b9cbf8c9e0bc72f59b643165247fae646560aadd
commit r12-2582-gb9cbf8c9e0bc72f59b643165247fae646560aadd
Author: Martin Sebor <msebor@redhat.com>
Date: Wed Jul 28 16:14:38 2021 -0600
Correct -Warray-bounds handling if function pointers [PR101601].
Resolves:
PR middle-end/101601 - -Warray-bounds triggers error: arrays of functions
are not meaningful
PR middle-end/101601
gcc/ChangeLog:
* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref):
Remove
a pointless test.
Handle pointers to functions.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Warray-bounds-25.C: New test.
* gcc.dg/Warray-bounds-85.c: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers error: arrays of functions are not meaningful
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2021-07-28 22:16 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 22:17 ` msebor at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-28 22:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101601
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in r12-2582.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-07-28 22:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 15:01 [Bug c++/101601] New: [12 Regression] -Wall is reported as a build error (not warning): error: arrays of functions are not meaningful slyfox at gcc dot gnu.org
2021-07-23 15:10 ` [Bug middle-end/101601] " mpolacek at gcc dot gnu.org
2021-07-23 15:55 ` slyfox at gcc dot gnu.org
2021-07-23 17:27 ` [Bug middle-end/101601] [12 Regression] -Warray-bounds triggers " msebor at gcc dot gnu.org
2021-07-28 22:16 ` cvs-commit at gcc dot gnu.org
2021-07-28 22:17 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).