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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |tree-optimization
            Summary|missing uninitialized       |[9/10/11 Regression]
                   |warning for uninitialized   |missing -Wuninitialized for
                   |struct member (VOPs)        |struct member due to sra
                   |                            |and TREE_NO_WARNING
   Last reconfirmed|2019-11-02 00:00:00         |2021-4-16
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.2.0, 11.0, 4.5.3, 4.6.4,
                   |                            |4.9.4, 5.5.0, 6.4.0, 7.2.0,
                   |                            |8.3.0, 9.1.0

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
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

}

Reply via email to