David Brown <da...@westcontrol.com> writes: > The point of a warning like "unintialised variable" is static error > checking - it is to help spot mistakes in your code. And if there is > a path through the function that uses an uninitialised variable, > that's almost certainly a bug in your code - one you would like the > warning to tell you about.
In my opinion the current support for warnings about uninitialized variables is broken by design. This kind of warning has to be independent of optimizations. The current implementation is not stable across releases and it is very difficult for users to correctly predict the cases when it will and will not warn. While using the optimizers to improve the quality of uninitialized warnings does have some benefits, those benefits are outweighed by the drawbacks. We need to completely reimplement this warning, either in the C/C++ common frontend, or before any optimization passes run. Then we can rename the existing warning to -Wunpredictable-uninitialized and take it out of -Wall. Ian