diff mbox

PR target/79890: S/390: Fix crash.

Message ID 20170404220819.GA17106@linux.vnet.ibm.com
State New
Headers show

Commit Message

Dominik Vogt April 4, 2017, 10:08 p.m. UTC
The attached patch fixes PR 79890.  Bootstrapped and regression
tested on s390x biarch and s390.

Ciao

Dominik ^_^  ^_^

Comments

Andreas Krebbel April 5, 2017, 8:28 a.m. UTC | #1
On 04/05/2017 12:08 AM, Dominik Vogt wrote:
> The attached patch fixes PR 79890.  Bootstrapped and regression
> tested on s390x biarch and s390.

Applied.  Thanks!

-Andreas-
diff mbox

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 51b3d46..2cb8947 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9512,6 +9512,12 @@  s390_register_info_gprtofpr ()
   if (!TARGET_Z10 || !TARGET_HARD_FLOAT || !crtl->is_leaf)
     return;
 
+  /* builtin_eh_return needs to be able to modify the return address
+     on the stack.  It could also adjust the FPR save slot instead but
+     is it worth the trouble?!  */
+  if (crtl->calls_eh_return)
+    return;
+
   for (i = 15; i >= 6; i--)
     {
       if (cfun_gpr_save_slot (i) == SAVE_SLOT_NONE)
diff --git a/gcc/testsuite/gcc.target/s390/pr79890.c b/gcc/testsuite/gcc.target/s390/pr79890.c
new file mode 100644
index 0000000..e9894df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr79890.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Wno-pedantic" } */
+
+void bar (void);
+
+void
+foo (int x)
+{
+  __builtin_unwind_init ();
+  __builtin_eh_return (x, bar);
+}