https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121030
Bug ID: 121030
Summary: #pragma GCC diagnostic ignored
"-Wanalyzer-use-of-uninitialized-value" is ineffective
Product: gcc
Version: 15.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: eggert at cs dot ucla.edu
Target Milestone: ---
I ran into this bug when building Emacs. with gcc (GCC) 15.1.1 20250521 (Red
Hat 15.1.1-2) (Fedora 42) on x86-64. To reproduce, take the following program:
#pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
int f (int *p) { return *p; }
int main (void) { int x; return f(&x); }
and compile with 'gcc -fanalyzer -O2 -S t.c'. Although this should compile
quietly, it instead outputs a diagnostic, despite the pragma:
In function ‘main’:
cc1: warning: use of uninitialized value ‘x’ [CWE-457]
[-Wanalyzer-use-of-uninitialized-value]
‘main’: events 1-2
t.c:3:23:
3 | int main (void) { int x; return f(&x); }
| ^
| |
| (1) region created on stack here
| (2) capacity: 4 bytes
‘main’: event 3
cc1:
(3): use of uninitialized value ‘x’ here
I don't know whether this bug is related to GCC bug 109580.