[Bug c/56523] -Wunitialized is described to be enabled by -Wall
corentinjabot at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 4 17:33:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56523
--- Comment #2 from corentinjabot at gmail dot com 2013-03-04 17:33:26 UTC ---
Actually after a few more test it works correctly but the statement "This
enables some extra warning flags that are not enabled by -Wall." is confusing
since the to set of options overlap.
I also tested with the following c++ snippet:
#include <iostream>
class A {
public:
A() {}
bool foo;
void bar() {
if(foo)
std::cout << "Foo\n";
}
};
int main () {
A a;
a.bar();
return 0;
}
The uninitialized variable is detected only with -O1. It is vaguely documented
but that behavior seems quite odd and unexpected when you are not aware of it.
More information about the Gcc-bugs
mailing list