[Bug c++/69892] Missing -Wuninitialized warning
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 21 20:25:00 GMT 2016
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) {
^~~~~
More information about the Gcc-bugs
mailing list