https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106171

--- Comment #7 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
(In reply to Jakub Jelinek from comment #5)
> And -O1 -Wall warns:
> pr106171.c: In function ‘c’:
> pr106171.c:10:15: warning: ‘e[0]’ is used uninitialized [-Wuninitialized]
>    10 |       return e[0];
>       |              ~^~~
> pr106171.c:6:9: note: ‘e’ declared here
>     6 |     int e[2];
>       |         ^

Ah, this is quite clever of GCC :)
Clang fails to detect and warn about it.
CompCert lifts "int e[2]" to the same scope as "int d", thus also misses the
UB.

Reply via email to