[Bug middle-end/99768] [11 Regression] Bogus -Wuninitialized diagnostic with type punning

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 25 16:07:01 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-03-25
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever confirmed|0                           |1
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The -Wuninitialized was introduced in
g:b825a22890740f341eae566af27e18e528cd29a7.  I don't think I meant for this to
be diagnosed so I suspect it's a bug in the new code.  I see no basis in the IL
(below) to issue the warning.  GCC should issue -Wstrict-aliasing instead (it
does but only at level 2).

float foo (unsigned int v)
{
  float * f;
  unsigned int tmp;
  float _5;

  <bb 2> :
  tmp = v_2(D);
  f_4 = &tmp;
  _5 = *f_4;            << -Wuninitialized
  tmp ={v} {CLOBBER};
  return _5;

}


More information about the Gcc-bugs mailing list