https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118918
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- Note that GCC perfectly detects the issue at -O2 -Wall: In function 'c', inlined from 'j' at t.c:23:11: t.c:12:23: warning: using a dangling pointer to an unnamed temporary [-Wdangling-pointer=] 12 | unsigned g = d / e[f]; | ~^~~ t.c: In function 'j': t.c:7:17: note: unnamed temporary defined here 7 | e = (long[]){2}; | ^ Note that -O0 -Wall produces no warning does *NOT* mean it's "fine" with -O0. -O0 does not mean "allow me to write invalid code."