re PR middle-end/55321 (Ada bootstrap failure on armv5tel-linux-gnueabi)
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 29 Nov 2012 22:58:23 +0000 (22:58 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 29 Nov 2012 22:58:23 +0000 (22:58 +0000)
PR middle-end/55321
* calls.c (emit_library_call_value_1): Mark as no-nonlocal if no-throw.

From-SVN: r193973

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/loop_optimization14.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization14.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization14_pkg.ads [new file with mode: 0644]

index 24d73d53b607698c8cb8c56c1cef3d8844d0b84e..903a77cf4af1e15a85435a60ed985e0669e8116f 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR middle-end/55321
+       * calls.c (emit_library_call_value_1): Mark as no-nonlocal if no-throw.
+
 2012-11-29  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR middle-end/55456
index f4bed747e842463ff5f85feb3737832ce23ea5ab..574c247f0e50257fa3640db70c6f1b89f2bf6e71 100644 (file)
@@ -4196,13 +4196,11 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
      that it should complain if nonvolatile values are live.  For
      functions that cannot return, inform flow that control does not
      fall through.  */
-
   if (flags & ECF_NORETURN)
     {
       /* The barrier note must be emitted
         immediately after the CALL_INSN.  Some ports emit more than
         just a CALL_INSN above, so we must search for it here.  */
-
       rtx last = get_last_insn ();
       while (!CALL_P (last))
        {
@@ -4214,6 +4212,21 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
       emit_barrier_after (last);
     }
 
+  /* Consider that "regular" libcalls, i.e. all of them except for LCT_THROW
+     and LCT_RETURNS_TWICE, cannot perform non-local gotos.  */
+  if (flags & ECF_NOTHROW)
+    {
+      rtx last = get_last_insn ();
+      while (!CALL_P (last))
+       {
+         last = PREV_INSN (last);
+         /* There was no CALL_INSN?  */
+         gcc_assert (last != before_call);
+       }
+
+      make_reg_eh_region_note_nothrow_nononlocal (last);
+    }
+
   /* Now restore inhibit_defer_pop to its actual original value.  */
   OK_DEFER_POP;
 
index 996347b764f7a926c2ef3aef3d61f2e5801d00e1..54692e1d2ef017e3a9ac20e015bd6e75e9c505e2 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * loop_optimization14.ad[sb]: New test.
+       * loop_optimization14_pkg.ads: New helper.
+
 2012-11-29  Richard Earnshaw  <rearnsha@arm.com>
 
        PR target/55073
diff --git a/gcc/testsuite/gnat.dg/loop_optimization14.adb b/gcc/testsuite/gnat.dg/loop_optimization14.adb
new file mode 100644 (file)
index 0000000..c53c484
--- /dev/null
@@ -0,0 +1,29 @@
+-- PR middle-end/55321
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Loop_Optimization14_Pkg; use Loop_Optimization14_Pkg;
+
+package body Loop_Optimization14 is
+
+   procedure Finalize_Pool (Pool : in out Rec) is
+      Raised : Boolean := False;
+   begin
+      Pool.A := True;
+
+      while not Pool.B loop
+
+         begin
+            Proc (Pool.B);
+
+         exception
+            when others =>
+               if not Raised then
+                  Raised := True;
+               end if;
+         end;
+      end loop;
+
+   end;
+
+end Loop_Optimization14;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization14.ads b/gcc/testsuite/gnat.dg/loop_optimization14.ads
new file mode 100644 (file)
index 0000000..ee99405
--- /dev/null
@@ -0,0 +1,13 @@
+package Loop_Optimization14 is
+
+   type Rec is record
+      A : Boolean;
+      pragma Atomic (A);
+
+      B : Boolean;
+
+   end record;
+
+   procedure Finalize_Pool (Pool : in out Rec);
+
+end Loop_Optimization14;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization14_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization14_pkg.ads
new file mode 100644 (file)
index 0000000..23b61eb
--- /dev/null
@@ -0,0 +1,5 @@
+package Loop_Optimization14_Pkg is
+
+   procedure Proc (B : in out Boolean);
+
+end Loop_Optimization14_Pkg;