summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-22 09:08:58 +0000
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-22 09:08:58 +0000
commit1b448af3491b387007237149ebb6bef85b8d0f75 (patch)
tree0608f8bdc0b348c96a90ad8cff963d50ce91c87c /gcc
parentca6399a01a0e86e20f771d98b26dc78c3f77220e (diff)
downloadgcc-1b448af3491b387007237149ebb6bef85b8d0f75.tar.gz
* config/pa/pa.c (output_call): Don't optimize post call jumps
into return address adjustments if the call may throw. testsuite/ * gnat.dg/raise_ce.adb: Helper for ... * gnat.dg/handle_and_return.adb: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148780 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/pa/pa.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gnat.dg/handle_and_return.adb21
-rw-r--r--gcc/testsuite/gnat.dg/raise_ce.adb4
5 files changed, 40 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 308a1f73373..8d171708beb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-22 Olivier Hainque <hainque@adacore.com>
+
+ * config/pa/pa.c (output_call): Don't optimize post call jumps
+ into return address adjustments if the call may throw.
+
2009-06-21 Richard Earnshaw <rearnsha@arm.com>
* arm.c (thumb1_output_casesi): New function.
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index a55f2ec0147..c8cf714d21d 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -7701,12 +7701,15 @@ output_call (rtx insn, rtx call_dest, int sibcall)
if (!delay_slot_filled && INSN_ADDRESSES_SET_P ())
{
/* See if the return address can be adjusted. Use the containing
- sequence insn's address. */
+ sequence insn's address. This would break the regular call/return@
+ relationship assumed by the table based eh unwinder, so only do that
+ if the call is not possibly throwing. */
rtx seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
int distance = (INSN_ADDRESSES (INSN_UID (JUMP_LABEL (NEXT_INSN (insn))))
- INSN_ADDRESSES (INSN_UID (seq_insn)) - 8);
- if (VAL_14_BITS_P (distance))
+ if (VAL_14_BITS_P (distance)
+ && !(can_throw_internal (insn) || can_throw_external (insn)))
{
xoperands[1] = gen_label_rtx ();
output_asm_insn ("ldo %0-%1(%%r2),%%r2", xoperands);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 00dee392eb3..089d9b48c11 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-22 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/raise_ce.adb: Helper for ...
+ * gnat.dg/handle_and_return.adb: New test.
+
2009-06-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40443
diff --git a/gcc/testsuite/gnat.dg/handle_and_return.adb b/gcc/testsuite/gnat.dg/handle_and_return.adb
new file mode 100644
index 00000000000..b40dbafb37d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/handle_and_return.adb
@@ -0,0 +1,21 @@
+-- { dg-do run }
+-- { dg-options "-gnatp -O2" }
+
+with Raise_Ce;
+
+procedure Handle_And_Return is
+begin
+ begin
+ Raise_CE;
+ return;
+ exception
+ when others => null;
+ end;
+
+ begin
+ Raise_CE;
+ return;
+ exception
+ when others => null;
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/raise_ce.adb b/gcc/testsuite/gnat.dg/raise_ce.adb
new file mode 100644
index 00000000000..f526beef50e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/raise_ce.adb
@@ -0,0 +1,4 @@
+procedure Raise_CE is
+begin
+ raise Constraint_Error;
+end;