This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ppc __builtin_eh_return with -mminimal-toc
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>, Alan Modra <amodra at bigpond dot net dot au>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 12 Apr 2003 06:38:40 -0400
- Subject: [PATCH] Fix ppc __builtin_eh_return with -mminimal-toc
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
/* { dg-do compile { powerpc*-*-* } } */
/* { dg-options "-mminimal-toc -O2" } */
void foo (long x, void *y)
{
void *a;
__builtin_unwind_init ();
do
{
a = __builtin_frob_return_addr (y);
__builtin_eh_return (x, y);
} while (0);
}
is broken on ppc64-linux, restoring of %r2 is optimized away.
The reason is that TOC_REGISTER is:
#define TOC_REGISTER (TARGET_MINIMAL_TOC ? RS6000_PIC_OFFSET_TABLE_REGNUM : 2)
and thus EPILOGUE_USES uses register %r30, not %r2 which __builtin_eh_return
computes.
Ok to commit?
2003-04-12 Jakub Jelinek <jakub at redhat dot com>
* config/rs6000/rs6000.h (EPILOGUE_USES): Use register 2,
instead of TOC_REGISTER in epilogue in
current_function_calls_eh_return functions.
--- gcc/config/rs6000/rs6000.h.jj 2003-04-11 14:20:32.000000000 -0400
+++ gcc/config/rs6000/rs6000.h 2003-04-12 06:24:58.000000000 -0400
@@ -1858,7 +1858,7 @@ typedef struct rs6000_args
|| (TARGET_ALTIVEC && (REGNO) == VRSAVE_REGNO) \
|| (current_function_calls_eh_return \
&& TARGET_AIX \
- && (REGNO) == TOC_REGISTER))
+ && (REGNO) == 2))
/* TRAMPOLINE_TEMPLATE deleted */
Jakub