[Bug middle-end/54804] -Wuninitialized fails to warn about uninitialized local union

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 25 23:13:17 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |msebor at gcc dot gnu.org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |7.0
           Keywords|                            |diagnostic

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 7 and later warn for both.  The change was introduced in r245840.

pr54804.c: In function ‘yyparse’:
pr54804.c:7:13: warning: ‘yylval’ is used uninitialized [-Wuninitialized]
    7 |      return yylval;
      |             ^~~~~~
pr54804.c:6:20: note: ‘yylval’ declared here
    6 |      union YYSTYPE yylval;
      |                    ^~~~~~
pr54804.c: In function ‘yyparse_with_struct’:
pr54804.c:16:13: warning: ‘xxlval’ is used uninitialized [-Wuninitialized]
   16 |      return xxlval;
      |             ^~~~~~
pr54804.c:15:15: note: ‘xxlval’ declared here
   15 |      struct s xxlval;
      |               ^~~~~~


More information about the Gcc-bugs mailing list