This is the mail archive of the
mailing list for the GCC project.
Re: better -Wuninitialized (Re: Ada files now checked in)
On Sun, 07 Oct 2001, Zack Weinberg wrote:
> 1 int a, b;
> 3 b = foo();
> 4 if (b < 100)
> 5 a = 10;
> 6 bar();
> 7 if (b < 100)
> 8 b = b + a;
Ah, now I see what you're getting at. You would get a warning in
this case. Currently there is no pruning of reaching definitions
sets. We could add some, but you have to be careful not to make
it excessively expensive.
Also remember that this warning is triggered rather early in the
analysis. Well before any transformations are done, suppose that
for whatever reason B is deemed to always be greater than 100.
You would've gotten a warning for dead code.
> > OTOH, if the compiler is already warning you that you're using the
> > thing uninitialized, why would you also need this run-time trick?
> Because you may incorrectly think you have inspected the code and
> determined that there is no actual problem. This is of course more
> likely the more false positives there are.
True. 0xdeadbeef sounds good for pointers and word integers.
> The bitmaps are probably sparse, and n_basic_blocks can blow up, at
> which point your memory usage blows up too. Brad Lucier has some good
> examples of this problem.
OK. We should take a look at this once the implementation starts