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++/69892] Missing -Wuninitialized warning


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

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Well, gcc warns without the assignment in the loop, e.g.:

markus@x4 tmp % cat bool_.ii
int a;
int main() {
  bool valid;
  while (valid) {
    a++;
   // valid = false;
  }
  if (a != 1)
    __builtin_abort();
}

markus@x4 tmp % g++ -Wall bool_.ii
bool_.ii: In function âint main()â:
bool_.ii:4:3: warning: âvalidâ is used uninitialized in this function
[-Wuninitialized]
   while (valid) {
   ^~~~~

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