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

builtin_eh_return requires the return address to be saved on the
stack.  The patch prevents using an FPR for that.

gcc/ChangeLog:

2017-04-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	PR target/79890
	* config/s390/s390.c (s390_register_info_gprtofpr): Return if
	call_eh_return is true.

gcc/testsuite/ChangeLog:

2017-04-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	PR target/79890
	* gcc.target/s390/pr79890.c: New test case.

From-SVN: r246701
This commit is contained in:
Dominik Vogt 2017-04-05 08:28:18 +00:00 committed by Andreas Krebbel
parent b88a6a8818
commit d0ee17a526
4 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-04-05 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/79890
* config/s390/s390.c (s390_register_info_gprtofpr): Return if
call_eh_return is true.
2017-04-05 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390-c.c (s390_resolve_overloaded_builtin):

View File

@ -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)

View File

@ -1,3 +1,8 @@
2017-04-05 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/79890
* gcc.target/s390/pr79890.c: New test case.
2017-04-05 Jakub Jelinek <jakub@redhat.com>
PR target/80310

View File

@ -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);
}