[Bug middle-end/61112] Simple example triggers false-positive -Wmaybe-uninitialized warning

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 3 21:54:00 GMT 2019


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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2019-03-03
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|FIXED                       |---
     Ever confirmed|0                           |1

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The underlying issue is still there, according to this slightly more
complicated test case:

int p;

void
foo (int x, int y, int z, int a)
{
  int w;
  if (x)
    w = z;
  if (y)
    w = 10;
  if (a)
    w = 67;

  if (x || y || a)
    p = w;
}

$ g++ 61112.c -O2 -Wall -fdump-tree-uninit-details
61112.c: In function ‘void foo(int, int, int, int)’:
61112.c:15:7: warning: ‘w’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
   15 |     p = w;


More information about the Gcc-bugs mailing list