[Bug c++/103159] -Wuninitialized should not depend on optimization level

mathieu.malaterre at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 9 14:22:47 GMT 2021


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

--- Comment #1 from Mathieu Malaterre <mathieu.malaterre at gmail dot com> ---
Just to be sure, here is the actual command I had been starring at for a while:

```
% g++ -o undef -fsanitize=undefined -Wuninitialized undef.cxx && ./undef
21845
```

Maybe I got confused with `-fsanitize=undefined` and (maybe?) g++ behavior at
default -O0 really does initialize all members in the class...

In any case my usual rule of thumb is to remove optimization flag when doing
debug/high warning level compilation.


More information about the Gcc-bugs mailing list