This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31878] Spurious warnings generated due to not optimizing first
- 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: 11 May 2007 10:38:44 -0000
- Subject: [Bug c/31878] Spurious warnings generated due to not optimizing first
- References: <bug-31878-6477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from manu at gcc dot gnu dot org 2007-05-11 11:38 -------
(In reply to comment #4)
> So obviously it knows, at the level of the code generator, it's just a question
> of propagating that information back to the frontend.
I wrote: "yes, as far as GCC knows when it emits the warning, f() may return
without a value". So obviously, code generation happens way after the warning
is emitted. There is no "propagating back information to the front-end". Sorry.
This is not how GCC works. So, yes, fixing this may require rewriting GCC. But
even if it were trivial, that is, even if when using optimisation we could
detect that no warning is needed, there is the current policy of giving (in
general) the same warnings with and without optimisation. Thus, GCC may still
decide to give a warning.
So I still don't think this is worthy to be called a bug, at best it is
WONTFIX. But, hey!, if you want to keep it open in case some brave volunteer
developer appears from the void and decides to contribute some magical patch...
who knows, the hero might be you. ;-)
> Speaking of the same warnings with-or-without optimizations - should I then
> file a bug about:
[snip]
> No warning about y being used uninitialized unless I compile with
> optimizations...
Currently, -Wuninitialized needs optimisation to do any work. This may change
in the future, though. You chose one of the few exceptions to illustrate your
point.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31878