https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43361
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note GCC 12 now diagnoses this at -O0, reporting the first use:
> ../../obj-gcc12-g/gcc/cc1 -quiet t.c -Wall
t.c: In function 'main':
t.c:5:13: warning: variable 'array' set but not used
[-Wunused-but-set-variable]
5 | int array[10];
| ^~~~~
t.c:6:17: warning: 'i' is used uninitialized [-Wuninitialized]
6 | for (; i<10; ++i) { // no warning
| ~^~~
t.c:4:13: note: 'i' was declared here
4 | int i;
| ^
PR101573 is a "duplicate" we have a testcase for now.
*** This bug has been marked as a duplicate of bug 101573 ***