Hi, this patchlet ensures that return statements are preserved at -O0 so that you can put a breakpoint on them in the debugger.
Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline? 2011-04-06 Eric Botcazou <ebotca...@adacore.com> * gimple-low.c (lower_gimple_return): When not optimizing, force labels associated with user returns to be preserved. 2011-04-06 Eric Botcazou <ebotca...@adacore.com> * gnat.dg/return3.adb: New test. -- Eric Botcazou
Index: gimple-low.c =================================================================== --- gimple-low.c (revision 172018) +++ gimple-low.c (working copy) @@ -758,6 +758,9 @@ lower_gimple_return (gimple_stmt_iterato /* Generate a goto statement and remove the return statement. */ found: + /* When not optimizing, make sure user returns are preserved. */ + if (!optimize && gimple_has_location (stmt)) + DECL_ARTIFICIAL (tmp_rs.label) = 0; t = gimple_build_goto (tmp_rs.label); gimple_set_location (t, gimple_location (stmt)); gimple_set_block (t, gimple_block (stmt));
-- { dg-do compile { target *-*-linux* } } -- { dg-options "-gdwarf-2 -dA" } procedure Return3 is begin return; end; -- { dg-final { scan-assembler "loc 1 6" } }