diff mbox

[stmt.c] : Fix SjLj exception handling

Message ID CAEwic4YMG2O_ckZ1K8qCLp6LcGEiLSUDnKkw9jgNUBdFFP_a-g@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Dec. 1, 2012, 9:59 p.m. UTC
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

Comments

Steven Bosscher Dec. 1, 2012, 10:28 p.m. UTC | #1
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
NightStrike Dec. 9, 2012, 4:17 p.m. UTC | #2
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.
Richard Biener Dec. 10, 2012, 9:21 a.m. UTC | #3
On Sun, Dec 9, 2012 at 5:17 PM, NightStrike <nightstrike@gmail.com> wrote:
> 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.

Ok.

Thanks,
Richard.
diff mbox

Patch

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