This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/69892] Missing -Wuninitialized warning
- From: "trippels at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 21 Feb 2016 20:25:20 +0000
- Subject: [Bug c++/69892] Missing -Wuninitialized warning
- Auto-submitted: auto-generated
- References: <bug-69892-4 at http dot gcc dot gnu dot org/bugzilla/>
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) {
^~~~~