[Bug c++/70410] no uninitialized variable warning if 'offsetof' is used in expression

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 25 09:46:00 GMT 2017


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |egallager at gcc dot gnu.org
      Known to work|                            |8.0
         Resolution|---                         |WORKSFORME

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
gcc8 warns for me:

$ /usr/local/bin/g++ -c -Wuninitialized 70410.cc
70410.cc: In function ‘int main()’:
70410.cc:12:12: warning: ‘a’ is used uninitialized in this function
[-Wuninitialized]
  int b = a + offsetof(C, y); // <= missing warning that 'a' is uninitialized
            ^
$


More information about the Gcc-bugs mailing list