From 516426da9f3147a1eda0740ec4b5d1fd8b3070cb Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 6 Apr 2011 09:34:02 +0000 Subject: [PATCH] gimple-low.c (lower_gimple_return): When not optimizing, force labels associated with user returns to be preserved. * gimple-low.c (lower_gimple_return): When not optimizing, force labels associated with user returns to be preserved. From-SVN: r172030 --- gcc/ChangeLog | 5 +++++ gcc/gimple-low.c | 3 +++ gcc/testsuite/ChangeLog | 6 +++++- gcc/testsuite/gnat.dg/return3.adb | 9 +++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/return3.adb diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ea011856a3..a8f86616a65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-06 Eric Botcazou + + * gimple-low.c (lower_gimple_return): When not optimizing, force labels + associated with user returns to be preserved. + 2011-04-06 Tristan Gingold * dbxout.c: (debug_nesting, symbol_queue, symbol_queue_index) diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 67087a0aadc..9d774429bab 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -758,6 +758,9 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data) /* 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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c7e70b25205..cb11813f291 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ +2011-04-06 Eric Botcazou + + * gnat.dg/return3.adb: New test. + 2011-04-06 Richard Guenther - + PR tree-optimization/47663 * gcc.dg/tree-ssa/inline-8.c: New testcase. diff --git a/gcc/testsuite/gnat.dg/return3.adb b/gcc/testsuite/gnat.dg/return3.adb new file mode 100644 index 00000000000..7ebe7499005 --- /dev/null +++ b/gcc/testsuite/gnat.dg/return3.adb @@ -0,0 +1,9 @@ +-- { dg-do compile { target *-*-linux* } } +-- { dg-options "-gdwarf-2 -dA" } + +procedure Return3 is +begin + return; +end; + +-- { dg-final { scan-assembler "loc 1 6" } } -- 2.30.2