The attached patch fixes PR 79890. Bootstrapped and regression tested on s390x biarch and s390.
Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany
gcc/ChangeLog-pr79890 PR target/79890 * config/s390/s390.c (s390_register_info_gprtofpr): Return if call_eh_return is true. gcc/testsuite/ChangeLog-pr79890 PR target/79890 * gcc.target/s390/pr79890.c: New test case.
>From 99062b1d7476132c996966f15c11c3090e0dcd2a Mon Sep 17 00:00:00 2001 From: Dominik Vogt <v...@linux.vnet.ibm.com> Date: Tue, 4 Apr 2017 12:31:43 +0100 Subject: [PATCH] PR target/79890: S/390: Fix crash. --- gcc/config/s390/s390.c | 6 ++++++ gcc/testsuite/gcc.target/s390/pr79890.c | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/pr79890.c 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); +} -- 2.3.0