gimple-low.c (lower_gimple_return): When not optimizing, force labels associated...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 6 Apr 2011 09:34:02 +0000 (09:34 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 6 Apr 2011 09:34:02 +0000 (09:34 +0000)
* gimple-low.c (lower_gimple_return): When not optimizing, force labels
associated with user returns to be preserved.

From-SVN: r172030

gcc/ChangeLog
gcc/gimple-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/return3.adb [new file with mode: 0644]

index 5ea011856a3698ee4453ae7346eb35fdf489fc4f..a8f86616a65a7650804dfa609aa0f501a1074102 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gimple-low.c (lower_gimple_return): When not optimizing, force labels
+       associated with user returns to be preserved.
+
 2011-04-06  Tristan Gingold  <gingold@adacore.com>
 
        * dbxout.c: (debug_nesting, symbol_queue, symbol_queue_index)
index 67087a0aadc12907561e4c806f0d46f2f2c6728a..9d774429bab9fefecf76fd3fc878f59c3f96f783 100644 (file)
@@ -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));
index c7e70b25205cb285a38106501754ab5a1c8b917c..cb11813f2914447bd9e764172f1f0eaf75e6b17d 100644 (file)
@@ -1,5 +1,9 @@
+2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/return3.adb: New test.
+
 2011-04-06  Richard Guenther  <rguenther@suse.de>
+
        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 (file)
index 0000000..7ebe749
--- /dev/null
@@ -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" } }