[Bug tree-optimization/89976] [9/10/11/12 Regression] missing -Wuninitialized for struct member due to sra and TREE_NO_WARNING

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jun 26 15:17:53 GMT 2021


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

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #4)
> In all cases and with -O1 and above, the uninitialized read is clearly
> visible in the IL but it's suppressed because the variable (such as x$x in
> case 1) has the TREE_NO_WARNING bit set.  This appears to be regression
> introduced in GCC 4.5 in r147980.
> 
> gcc -O1 -S -Wall -std=c++14 -fdump-tree-uninit=/dev/stdout pr89976.C 
> 
> ;; Function foo (_Z3foov, funcdef_no=3, decl_uid=2098, cgraph_uid=4,
> symbol_order=3)
> 
> struct X foo ()
> {
>   int x$x;                             <<< TREE_NO_WARNING == 1
>   struct X D.2133;
> 
>   <bb 2> [local count: 1073741824]:
>   D.2133.x = x$x_2(D);                 <<< uninitialized read
>   D.2133.y = 0;
>   return D.2133;
> 
> }
> 
> 
> 
> ;; Function main (main, funcdef_no=4, decl_uid=2129, cgraph_uid=5,
> symbol_order=4) (executed once)
> 
> int main ()
> {
>   int x$x;                             <<< TREE_NO_WARNING == 1
>   struct X D.2156;
>   struct X x;
> 
>   <bb 2> [local count: 1073741824]:
>   x ={v} {CLOBBER};
>   return x$x_5(D);                     <<< uninitialized read
> 
> }

did your TREE_NO_WARNING overhaul affect this at all?


More information about the Gcc-bugs mailing list