From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10828 invoked by alias); 13 Feb 2003 21:06:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 10785 invoked by uid 71); 13 Feb 2003 21:06:01 -0000 Date: Thu, 13 Feb 2003 21:06:00 -0000 Message-ID: <20030213210601.10783.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Steven Bosscher Subject: Re: optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning Reply-To: Steven Bosscher X-SW-Source: 2003-02/txt/msg00592.txt.bz2 List-Id: The following reply was made to PR optimization/7189; it has been noted by GNATS. From: Steven Bosscher To: gcc-gnats@gcc.gnu.org, am-99173@konami.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Cc: rth@redhat.com Subject: Re: optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning Date: 13 Feb 2003 22:04:14 +0100 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7189 This is a bug that happens when sibcall optimizations are performed. It does not matter what other optimizations are enabled. When you do gcc -O0 -Wall -foptimize-sibling-calls, the warning about the non-void function not returning anything doesn't show up. The test case in the PR is: extern void foo(void); int bar(void) { foo(); } Without sibcall optimization, the warning is issued. The warning always shows up with gcc 2.95.3, so technically one could argue it's a regression... The problem seems to be that after the sibcall optimizations, the cfg cleanup after jump optimizations also cleans up the clobber INSN for the function result (output for -c -Wall -foptimize-sibling-calls, todays mainline CVS): --- c7189.c.01.sibling Thu Feb 13 16:52:05 2003 +++ c7189.c.03.jump Thu Feb 13 16:52:05 2003 @@ -1,14 +1,29 @@ --- pass specific dump info cut out --- @@ -27,19 +42,4 @@ (barrier 11 10 14) -(note 14 11 23 NOTE_INSN_FUNCTION_END) - -(note 23 14 18 1 [bb 1] NOTE_INSN_BASIC_BLOCK) - -(insn 18 23 19 1 (nil) (clobber (reg/i:SI 0 eax)) -1 (nil) - (nil)) - -(insn 19 18 17 1 (nil) (clobber (reg:SI 58 [ ])) -1 (nil) - (nil)) - -(insn 17 19 20 1 (nil) (set (reg/i:SI 0 eax) - (reg:SI 58 [ ])) -1 (nil) - (nil)) - -(insn 20 17 0 1 (nil) (use (reg/i:SI 0 eax)) -1 (nil) - (nil)) +(note 14 11 0 NOTE_INSN_FUNCTION_END) One way to "fix" this bug is to move check_function_return_warnings() up to before sibling call optimization in toplev.c, but maybe there's a more correct fix? Greetz Steven