[Bug middle-end/65686] New: incorrect warning maybe-uninitialized

dimhen at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 7 12:25:00 GMT 2015


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

            Bug ID: 65686
           Summary: incorrect warning maybe-uninitialized
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com

gcc version 5.0.0 20150404 (experimental) [trunk revision 221866] (GCC)

$ cat x.i
typedef unsigned mytype; // 'int' fixes issue

struct S {
  mytype *pu;
};

mytype f(struct S *e)
{
  mytype x;
  if(&x != e->pu)
    __builtin_memcpy(&x, e->pu, sizeof(unsigned));
  return x;
}

$ gcc -fpreprocessed -Werror -Wall -O2 -c x.i
x.i: In function ‘f’:
x.i:9:10: error: ‘x’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   mytype x;
          ^
cc1: all warnings being treated as error


More information about the Gcc-bugs mailing list