-Wmaybe-uninitialized

Manuel López-Ibáñez lopezibanez@gmail.com
Sat Nov 3 11:14:00 GMT 2018


On 02/11/2018 20:14, Martin Sebor wrote:
> The code is optimized early on the assumption that x cannot be
> used uninitialized (the test is folded to true).  The uninitialized
> warning runs much later and doesn't see the eliminated uninitialized
> path.  It's tempting to say it's a bug that GCC folds the code without
> warning about the uninitialized path.  The CPP pass obviously sees
> that the value is uninitialized in the else branch and makes
> a decision to optimize based on it, so it seems that it should
> be able to issue a warning for it.  The question is how noisy
> implementing it there (as well) would be.

This is infamous https://gcc.gnu.org/PR18501

You can see everything that has been tried and discussed there.

Nobody has been able to fix it in the last 14 years.

The solution that Clang uses is to do a limited data flow analysis in the FE 
and warn from the FE.

Any help welcome: 
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps

Cheers,

Manuel.



More information about the Gcc-help mailing list