This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/45468] gcc does not warn about missing `-O' flag when specifying `-Wuninitialized'
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Aug 2010 21:34:05 -0000
- Subject: [Bug c/45468] gcc does not warn about missing `-O' flag when specifying `-Wuninitialized'
- References: <bug-45468-16461@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from manu at gcc dot gnu dot org 2010-08-31 21:34 -------
(In reply to comment #14)
> > depend on which optimization passes are run (and their order). See
> > http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings for more background on
> > the issues involved and existing bugs.
>
> :( It is an unfortunate truth that GCC's warnings are sometimes far from
> optimal, but maybe it's also good in some ways. For one thing, it forces us
> programmers to be more conscientious while coding.
I don't think the situation is good at all. It is one of the favourite themes
of criticism towards GCC. One reason why Clang warnings are better than GCC's
is that Clang has some degree of dataflow analysis in the front-end.
Unfortunately, GCC lacks any dataflow analysis in front-ends, where most
warnings occur. Even in middle-end warnings, one cannot enable the analysis
without enabling code transformations. It would be fantastic to have (1) fast
data-flow analysis that can work on the front-end (similar to those of Clang
static analyzer), (2) a way to enable some middle-end analysis without enabling
any code transformations. However, as far as I know, no one in GCC is even
thinking about either. Sorry.
(Item 1 is particularly difficult because GCC C/C++ front-ends are very slow
already, so adding more stuff on top is highly unwelcome.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45468