waf: compiler flags, uninitalized variable

Fred Wright fw at fwright.net
Fri Aug 1 14:40:27 UTC 2025


On Fri, 1 Aug 2025, Hal Murray wrote:

> devel at ntpsec.org said:
>> Usually, you won't get that type of warning unless you enable it.  And
>> usually, you only get that type of warning in an optimized compile, since
>>  the dataflow analysis needed to detect it is part of the optimization
>> code.
>
> I tried O3.  That found a different maybe-uninitialized.
>
> I tried O6.  Nothing new.

The other thing I forgot to mention is that sometimes the control-flow 
analysis isn't as good in older compilers, leading to complaints about 
something being used uninitialized in a case where the code couldn't 
actually be reached in the unininitialized case.  Unless there's a good 
reason to avoid it, usually the best fix is just to add an initializer to 
the declaration, even if it's not logically necessary.

Fred Wright


More information about the devel mailing list