https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109916
Bug ID: 109916
Summary: warning reported despite of "#pragma GCC diagnostic
ignored", due to -flto
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: bruno at clisp dot org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Created attachment 55127
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55127&action=edit
test case sources s.tar.xz
When adding option '-flto' to the gcc command line, diagnostics that are
ordinarily suppressed through "#pragma GCC diagnostic ignored ..." get reported
nevertheless.
How to reproduce:
1. Unpack the attached sources s.tar.xz.
$ gcc --version
gcc (GCC) 13.1.0
...
$ gcc -Wmaybe-uninitialized -O2 s/*.c -o cut
<no diagnostic>
$ gcc -Wmaybe-uninitialized -O2 s/*.c -o cut -flto
In function ‘getndelim2’,
inlined from ‘cut_fields’ at s/cut.c:5185:17:
s/getndelim2.c:2015:23: warning: ‘c’ may be used uninitialized
[-Wmaybe-uninitialized]
2015 | *read_pos = c;
| ^
s/getndelim2.c: In function ‘cut_fields’:
s/getndelim2.c:1934:11: note: ‘c’ was declared here
1934 | int c;
| ^