This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/64823] New: [5.0 Regression] false "may be used uninitialized"


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

            Bug ID: 64823
           Summary: [5.0 Regression] false "may be used uninitialized"
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alserkli at inbox dot ru

Compilation of (GDB) 7.9.50.20150127-cvs with (GCC) 5.0.0 20150127 fails due to
false warning (gdb is compiled with -Werror). It was not a problem in GCC
4.7.2.

// a.c: simplified from the expansion of ALL_OBJSECTIONS in
gdb/gdb/symfile.c:unmap_overlay_command
struct os { struct o *o; };
struct o { struct o *next; struct os *se; };
void f(struct o *o){
  struct os *s;
  if(o) s = o->se;
  while(o && s == o->se){
    s++; // here `o' is non-zero and thus s is initialized
    s == o->se  // `?' is essential, `if' does not trigger the warning
      ? (o = o->next, o ? s = o->se : 0)
      : 0;
  }
}

$ gcc -O2 -Wall -Werror -c a.c
a.c: In function âfâ:
a.c:8:6: error: âsâ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
     s++; // here `o' is non-zero and thus s is initialized
      ^
cc1: all warnings being treated as errors

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]