[Bug c/61409] New: [4.9 regression] -Wmaybe-uninitialized false-positive with -O2

eggert at gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 4 07:40:00 GMT 2014


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

            Bug ID: 61409
           Summary: [4.9 regression] -Wmaybe-uninitialized false-positive
                    with -O2
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org

Created attachment 32887
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32887&action=edit
sample program illustrating the false positive

GCC 4.9.0 x86-64.  I do not observe the bug with GCC 4.8.2.

I discovered this bug when compiling GNU Emacs, and abstracted it into the
simplest test case I could easily generate.  When I compile the attached
program g.i with the command:

gcc -Wmaybe-uninitialized -O2 -c g.i

GCC warns:

g.i:607:21: warning: 'mw' may be used uninitialized in this function
[-Wmaybe-uninitialized]
       mw->pixel_top = rw->pixel_height;

But mw cannot possibly be uninitialized here.  Also, mw was used in the
previous line, with no warning.

The bug may be related to lines 602 and 603, which are long and which do not
mention mw, as removing these lines makes the diagnostic go away.



More information about the Gcc-bugs mailing list