This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix must-not-throw regions with SJLJ exception handling
- From: Richard Henderson <rth at redhat dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 21 Jan 2011 08:47:12 -0800
- Subject: Re: [PATCH] Fix must-not-throw regions with SJLJ exception handling
- References: <201101201927.p0KJR1mG006279@d06av02.portsmouth.uk.ibm.com>
On 01/20/2011 11:27 AM, Ulrich Weigand wrote:
> Hello,
>
> a couple of exception related tests are failing on SPU:
> FAIL: g++.dg/cpp0x/noexcept04.C execution test
> FAIL: g++.dg/cpp0x/noexcept05.C scan-assembler LSDA
> FAIL: g++.dg/eh/spec10.C execution test
> FAIL: g++.dg/eh/spec11.C scan-assembler LSDA
>
> These are related to must-not-throw regions. To implement those,
> we may have to register a personality function with empty LSDA.
> This has been implemented for DWARF CFI exception handling, but
> apparently not (fully?) for SJLJ exception handling.
>
> As far as I can see, there's two problems:
>
> - In sjlj_assign_call_site_values, the code sets the crtl->uses_eh_lsda
> to indicate an LSDA is needed. However this done by looping over all
> *landing pads* in the function -- but must-not-throw regions do not
> in fact have a landing pad, so they will be overlooked here.
>
> To fix this, the patch below moves setting crtl->uses_eh_lsda into the
> sjlj_mark_call_sites routine, which loops over all *insns*, just like
> convert_to_eh_region_ranges does for DWARF CFI.
>
> - Even so, if there are no landing pads at all, sjlj_mark_call_sites is
> not even called (and no code to install the SJLJ handler is emitted).
> But there can still be must-not-throw regions ...
>
> The patch below adds an extra check, if there are no landing pads,
> whether we still have must-not-throw regions (again by scanning the
> insns). If so, it generates code to register a simplified version
> of the SJLJ data structure, which only contains the personality
> function and an (empty) LSDA, but no actual setjmp landing pad.
I think the patch is nearly ok, except for this last part. I think that
sjlj_have_must_not_throw is redundant with function_needs_eh_personality.
You don't need to scan all the insns; merely the exception tree.
r~