This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7189: gcc -O2 -Wall does not print ``controlreaches end of non-void function'' warning
- From: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 13 Feb 2003 21:06:01 -0000
- Subject: Re: optimization/7189: gcc -O2 -Wall does not print ``controlreaches end of non-void function'' warning
- Reply-to: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
The following reply was made to PR optimization/7189; it has been noted by GNATS.
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
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 [ <result> ])) -1 (nil)
- (nil))
-
-(insn 17 19 20 1 (nil) (set (reg/i:SI 0 eax)
- (reg:SI 58 [ <result> ])) -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