[Bug middle-end/105539] -ftrivial-auto-var-init=zero happening too late?

qinzhao at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 10 16:40:25 GMT 2022


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

--- Comment #6 from qinzhao at gcc dot gnu.org ---
(In reply to qinzhao from comment #5)
> I am a little confused:
> 
> with gcc -Wuninitialized -O1 (without -ftrivial-auto-var-init=zero), there
> are two issues:
> 
> 1. the early uninitialized analysis didn't catch the uninitialized usage of
> y;
> 
> 
> 2. the ccp optimization deletes the if (z) statement completely:
> 
> [opc@qinzhao-aarch64-ol8 105539]$ cat t.c.034t.ccp1
> 
> ;; Function x (x, funcdef_no=0, decl_uid=3591, cgraph_uid=1, symbol_order=0)
> 
> Removing basic block 3
> Merging blocks 2 and 4
> int x (int z)
> {
>   int y;
> 
>   <bb 2> :
>   return 10;
> 
> }
> 
> are the above two bugs?

Is this because that "y" is uninitialized, so the behavior of this program is
undefined? then the above 2 is okay, but 1 is still an issue?


More information about the Gcc-bugs mailing list