From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8416 invoked by alias); 11 May 2007 10:38:57 -0000 Received: (qmail 8391 invoked by uid 48); 11 May 2007 10:38:44 -0000 Date: Fri, 11 May 2007 10:38:00 -0000 Message-ID: <20070511103844.8390.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/31878] Spurious warnings generated due to not optimizing first In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00812.txt.bz2 ------- 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