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) {
   ^~~~~

Reply via email to