From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27294 invoked by alias); 10 May 2007 16:51:42 -0000 Received: (qmail 27229 invoked by uid 48); 10 May 2007 16:51:26 -0000 Date: Thu, 10 May 2007 16:51:00 -0000 Message-ID: <20070510165126.27228.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: "lloyd at randombit dot net" 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/msg00785.txt.bz2 ------- Comment #4 from lloyd at randombit dot net 2007-05-10 17:51 ------- Manuel, For your example code, GCC _is_ aware that the function always returns, since the code it generates for it (with optimization) is: f: movl %edi, %eax ret So obviously it knows, at the level of the code generator, it's just a question of propagating that information back to the frontend. Speaking of the same warnings with-or-without optimizations - should I then file a bug about: int f(int x) { int y; if(x) return y; return 0; } No warning about y being used uninitialized unless I compile with optimizations... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31878