Dann Corbit wrote:
> Instead of just assigning a value, it means it is conceivable that a
> path allows undefined behavior. Example:
>
> ...
> int y;
> if (x < 5)
> y = 3;
> if (x > 5)
> y = 1;
>
> What happens if x == 5? Then y is indeterminate.
> Sometimes, the flow analysis just gets confused and it really will be
> initialized along every path. But at least it bears checking. Hence
> the warning.
Yes, I looked at the code, and they are legitimate warnings.
> I like to use -W -Wall -ansi -pedantic -O3
I use:
-Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wcast-align
You would think that would catch it. My problem is that I am compiling
with -O0, because I compile all day and I don't care about optimization.
In this case, the -O3 is doing some optimization that catches the
problem, while -O0 does not. Interesting. Even -O catches it.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073