https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99768
Bug ID: 99768 Summary: [11 Regression] Bogus -Wuninitialized diagnostic with type punning Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- For the following code (which has a strict aliasing violation): float foo(unsigned v) { unsigned tmp = v; float *f = (float *)(&tmp); return *f; } at -O2 -Wall we warn that tmp is used uninitialized: test.c: In function ‘foo’: test.c:5:12: warning: ‘tmp’ is used uninitialized [-Wuninitialized] 5 | return *f; | ^~ test.c:3:14: note: ‘tmp’ declared here 3 | unsigned tmp = v; | ^~~ but this is clearly bogus. Not sure if this is strictly considered a bug given the strict aliasing problem, but thought it might be worth checking in any case.