This is the mail archive of the
gcc-patches@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: Richard Henderson <rth at redhat dot com>
- Cc: gcc-gnats at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 01 Mar 2003 23:55:33 +0100
- Subject: Re: optimization/7189: gcc -O2 -Wall does not print ``controlreaches end of non-void function'' warning
- References: <1045170255.31261.7.camel@steven> <20030301003059.GD25419@redhat.com>
Op za 01-03-2003, om 01:30 schreef Richard Henderson:
> 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 take that back. Moving this to just after
> delete_unreachable_blocks should be just fine.
I just bootstrapped all except Ada and treelang with the attached patch,
regtesting now. OK for mainline and 3.3 if it passes?
Greetz
Steven
2003-03-01 Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
PR optimization/7189
* toplev.c (rest_of_compilation): Move
check_function_return_warnings up to just after
delete_unreachable_blocks.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.725
diff -c -3 -p -r1.725 toplev.c
*** toplev.c 1 Mar 2003 01:21:22 -0000 1.725
--- toplev.c 1 Mar 2003 22:43:44 -0000
*************** rest_of_compilation (decl)
*** 2625,2630 ****
--- 2625,2634 ----
delete_unreachable_blocks ();
+ /* We have to issue these warnings now already, because CFG cleanups
+ further down may destroy the required information. */
+ check_function_return_warnings ();
+
/* Turn NOTE_INSN_PREDICTIONs into branch predictions. */
if (flag_guess_branch_prob)
{
*************** rest_of_compilation (decl)
*** 3179,3186 ****
open_dump_file (DFI_life, decl);
regclass_init ();
-
- check_function_return_warnings ();
#ifdef ENABLE_CHECKING
verify_flow_info ();
--- 3183,3188 ----