warning: '<some_var>' may be used uninitialized in this function
Diego Novillo
dnovillo@redhat.com
Thu Jan 12 15:24:00 GMT 2006
On Thursday 12 January 2006 10:14, Perry Smith wrote:
> But... getting a compiler to figure that out is expecting too much.
> Did you try up'ing the optimization level (just out of curiosity)?
>
Right. He will have the same problem at any level.
The compiler cannot statically short-circuit that predicate because it
doesn't know whether best.score will be positive or not.
The chain of inferences that the compiler would need to do to properly
diagnose this case is beyond the scope of the mechanical transformations.
The reasoning you need to implement to catch these cases could even be
reduced to the halting problem.
The uninitialized warnings are fairly easy to trick. There is only so much
the compiler can realistically do.
More information about the Gcc
mailing list