optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning

Richard Henderson rth@redhat.com
Sat Mar 1 00:36:00 GMT 2003


The following reply was made to PR optimization/7189; it has been noted by GNATS.

From: Richard Henderson <rth@redhat.com>
To: Steven Bosscher <s.bosscher@student.tudelft.nl>
Cc: gcc-gnats@gcc.gnu.org, am-99173@konami.com, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning
Date: Fri, 28 Feb 2003 16:29:13 -0800

 On Thu, Feb 13, 2003 at 10:04:14PM +0100, Steven Bosscher wrote:
 > 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?
 
 I don't really like doing this earlier.  To get correct results
 we'd have to do an extra DCE pass, which seems wasteful wrt 
 compile-time for a warning.
 
 We should be able to detect this by looking at (1) predecessors
 of the EXIT block, (2) noticing that they end in a call_insn 
 with SIBLING_CALL_P set, and (3) noticing that the return value
 embedded in the call_insn is correct for the return value of
 the function.
 
 
 r~



More information about the Gcc-prs mailing list