This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch stmt.c]: Fix SjLj exception handling
On Sat, Dec 1, 2012 at 12:28 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Sat, Dec 1, 2012 at 10:59 PM, Kai Tietz wrote:
>> Hi,
>>
>> recent 4,8 has regressions in g++.old-deja/g++.eh for the catch*.C
>> tests, if exception-mechanism is SjLj. This is due an off by one
>> failure in an decreasing loop.
>>
>> ChangeLog
>>
>> 2012-12-01 Kai Tietz
>>
>> * stmt.c (expand_sjlj_dispatch_table): Fix off by one.
>>
>> Tested for i686-w64-mingw32, x86_64-unknown-linux-gnu. Ok for apply?
>>
>> Regards,
>> Kai
>>
>>
>> Index: stmt.c
>> ===================================================================
>> --- stmt.c (Revision 193985)
>> +++ stmt.c (Arbeitskopie)
>> @@ -2282,7 +2282,7 @@ expand_sjlj_dispatch_table (rtx dispatch_index,
>> tree range = maxval;
>> rtx default_label = gen_label_rtx ();
>>
>> - for (int i = ncases - 1; i > 0; --i)
>> + for (int i = ncases - 1; i >= 0; --i)
>> {
>> tree elt = dispatch_table[i];
>> tree low = CASE_LOW (elt);
>
>
> I can't approve this, but it's obvious. The "normal" switch expander
> (expand_case) expects the default case in slot 0, but the SJLJ
> dispatch table doesn't have a default case.
>
> Ciao!
> Steven
Ping.