[MPlayer-dev-eng] -Wall

J. Grant jg-lists at jguk.org
Sat Jun 5 04:02:34 CEST 2004


> Just for the record, the essence of it is:
> 
> if (condition) {
>   store a value in the variable
> }
> ... other code ...
> if (same_condition_as_before) {
>   use the value of the variable
> }
> 
> The compiler can't tell that the same conditional for initializing the
> variable also applies to using it. Perhaps this would be possible with
> some clever use of const keywords, but I doubt it even then. Compilers
> just aren't very smart...

It would need a control-flow simulator and tracking the graph to all its
end points etc.  Quite simple techniques, but I guess no one has got
around to it with gcc.  MSVC also has the same warning.

In this specific case adding the following to each point end node on
that control-flow originating if(dxy) would stop the warning:

==============
else uvdxy=0;
==============

This code would be dead and never run, it would be extra code to load
though through instruction cache.  So the simulator approach is better
than adding three pieces of dead code specifically for a gcc workaround!

Cheers

JG




More information about the MPlayer-dev-eng mailing list