https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583
Bug ID: 98583 Summary: missing -Wuninitialized reading from a second VLA in its own block Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- GCC diagnoses the uninitialized accessed in h1() but if fails to detect the same invalid access in h2(). $ cat x.c && gcc -O2 -S -Wall x.c void f (int*); void g (int); void h1 (int n) { int a[n]; f (a); int b[n]; g (b[1]); // -Wuninitialized (good) } void h2 (int n, int i, int j) { if (i) // ditto without this if... { int a[n]; f (a); } if (j) // ...or this if... { int b[n]; g (b[1]); // missing warning } } x.c: In function ‘h1’: x.c:10:3: warning: ‘*b[1]’ is used uninitialized [-Wuninitialized] 10 | g (b[1]); // -Wuninitialized (good) | ^~~~~~~~