On 06/12/2011 20:33, Jeff Law wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/06/11 12:21, Ian Lance Taylor wrote:
While using the optimizers to improve the quality of uninitialized
warnings does have some benefits, those benefits are outweighed by
the drawbacks. We need to completely reimplement this warning,
either in the C/C++ common frontend, or before any optimization
passes run.
Run it just after going into SSA; mark everything that has an
uninitialized use. For those who want the larger, much more stable
set of warnings this is going to meet their needs much better.
That's what my patch from a few years ago did. IIRC the only
outstanding issue was what should the default be.
Would it be possible then to have switches for different levels, such as
is done with the strict aliasing warnings?
In theory we could go ahead and translate into SSA when not optimizing
which would remove the dependency on -O, at the expense of
compile-time performance.
Do people often intentionally run gcc without any optimisations these
days? The compiler speed on -O1, relative to the speed of host
computers, means there are rarely compile speed reasons to turn off
optimisations. And for debugging, -O1 is often much easier to work with
than -O0, as the generated assembly makes more sense (more use of
registers and less blind use of the stack). If that is the case, then
it may be legitimate to always enable the basic analysis passes that are
needed for uninitialised warnings.
Then we can rename the existing warning to
-Wunpredictable-uninitialized and take it out of -Wall.
I'd tend to think this would be a mistake. We'd be changing -Wall in
a very very visible way and I suspect the number of developers
complaining would be huge.
Ideally we'd just nuke -Wall and have everyone use the -W options they
care about, but sadly that's just a pipe dream.
In my opinion, we should nuke -Wall - these warning options should all
be enabled unless explicitly /disabled/ with the -W options. And
-Werror should be enabled by default too. Just think how many bugs
would be found in existing software if developers were pushed into using
their tools effectively!
jeff