This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ Bug? use of alloca in a function prevents exception handler walkback on ppc linux
- To: khendricks at ivey dot uwo dot ca
- Subject: Re: g++ Bug? use of alloca in a function prevents exception handler walkback on ppc linux
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: Thu, 14 Dec 2000 10:12:19 -0800
- CC: gcc at gcc dot gnu dot org, dje at watson dot ibm dot com, Franz dot Sirl-kernel at lauterbach dot com, khendricks at ivey dot uwo dot ca
- References: <200012132027.eBDKR6e12042@ashley.ivey.uwo.ca> <00121408084001.16178@localhost> <20001214.15501400@eham02-sunray.federation.Germany.Sun.COM> <00121411275501.17144@localhost>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>
> Reply-To: khendricks@ivey.uwo.ca
> Date: Thu, 14 Dec 2000 11:40:27 -0500
> With a lot of help from Philipp Lohmann from Sun Germany, we have
> tracked the problem on ppc linux exception handling to the use of
> alloca in any function in the path back to the exception handler.
>
> This is what causes the "pc" in throw_helper to point out into the weeds.
>
> Is this a g++ bug?
It's a libgcc bug.
> Should dynamic allocation of stack space prevent the search back through the
> function by throw_helper?
No.
> Any guidance about how to deal with this would be greatly appreciated.
It's a known bug. The following workaround is a temporary patch, but
it causes a performance regression for C++. The correct fix is to
improve libgcc so that it can deal with this case.
--
- Geoffrey Keating <geoffk@geoffk.org>
===File ~/patches/cygnus/gcc-ehbug.patch====================
2000-12-07 Geoffrey Keating <geoffk@redhat.com>
* config/rs6000/rs6000.c (first_reg_to_save): Always save
the frame pointer register in functions that can throw.
(rs6000_emit_prologue): Save the frame pointer register
even if it is never live.
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.156
diff -u -p -r1.156 rs6000.c
--- rs6000.c 2000/11/19 18:49:31 1.156
+++ rs6000.c 2000/12/08 01:36:02
@@ -4705,6 +4705,11 @@ first_reg_to_save ()
}
}
+ if (first_reg == 32
+ && flag_exceptions
+ && (asynchronous_exceptions || ! current_function_is_leaf))
+ first_reg = 31;
+
return first_reg;
}
@@ -5665,7 +5670,10 @@ rs6000_emit_prologue()
&& ! call_used_regs[info->first_gp_reg_save+i])
|| (i+info->first_gp_reg_save == PIC_OFFSET_TABLE_REGNUM
&& (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && flag_pic == 1))
+ && flag_pic == 1)
+ || (i+info->first_gp_reg_save == FRAME_POINTER_REGNUM
+ && flag_exceptions
+ && (asynchronous_exceptions || ! current_function_is_leaf)))
{
rtx addr, reg, mem;
reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
============================================================