# Memory exhausted

**URL:** <https://www.ruby-forum.com/t/memory-exhausted/91581>\
**Category:** Ruby\
**Created:** [April 10, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581 "2007-04-10T18:15:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/1 "2007-04-10T18:15:54Z")

</div>

filename1 = “e:\jxkh\tools\getKhbz.rb”  
file1 = open(filename1,‘w’)  
file1.print “def getKhbz(did)\n”  
file1.print " case did\n"

cs = (1…2498).to\_a  
for j in cs do  
str = " when ‘" + j.to\_s + "’;return ‘" + j.to\_s + "’;\n"  
file1.print str  
end

file1.print " else\n"  
file1.print " return ‘’\n"  
file1.print " end\n"  
file1.print " end\n"

E:\jxkh\tools\>ruby getKhbz.rb  
getKhbz.rb:2499: memory exhausted  
when ‘2497’;return ‘2497’;

“memory exhausted”!!! why? please

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 6:44pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/2 "2007-04-10T18:44:39Z")

</div>

On Apr 10, 2007, at 09:15 , Ren Py wrote:

> E:\jxkh\tools\>ruby getKhbz.rb  
> getKhbz.rb:2499: memory exhausted  
> when ‘2497’;return ‘2497’;
> 
> “memory exhausted”!!! why? please

soooo many things open to critique, but not with regard to memory.

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/3 "2007-04-10T19:29:45Z")

</div>

On 4/10/07, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Apr 10, 2007, at 09:15 , Ren Py wrote:
> 
> > E:\jxkh\tools\>ruby getKhbz.rb  
> > getKhbz.rb:2499: memory exhausted  
> > when ‘2497’;return ‘2497’;
> > 
> > “memory exhausted”!!! why? please

I don’t know why you use a 2498 lines case only to return the same  
value you matched in the when statement. Anyway, I’ve tested the  
script with ruby 1.8.6 and I got the same error (memory exhausted). If  
I remove two lines of the case, it runs fine.

grepping the ruby source shows regex.c is the only file with that  
string. And thats how far I got. Any ideas?

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/4 "2007-04-10T19:35:46Z")

</div>

> > > E:\jxkh\tools\>ruby getKhbz.rb  
> > > grepping the ruby source shows regex.c is the only file with  
> > > that string. And thats how far I got. Any ideas?

Is ruby building a regular expression behind the scenes when evaluating  
a case statement for a bunch of strings?

- donald

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 7:53pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/5 "2007-04-10T19:53:49Z")

</div>

On Wed, 11 Apr 2007 02:28:33 +0900, “Luis P.”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> grepping the ruby source shows regex.c is the only file with that  
> string. And thats how far I got. Any ideas?

The error is coming from the parser. Here’s a simpler test case using  
integers:

eval \<\<EOS  
case x  
#{ (0…2498).map { |n| “when #{n}: nil\n” }.join(‘’) }  
end  
EOS

We know that it’s happening at parse-time rather than run-time, because  
the out-of-memory error occurs before Ruby has a chance to complain that  
‘x’ is undefined.

In short, the Ruby parser apparently cannot cope with case statements  
which have more than 2498 branches (at least with the build of Ruby I’ve  
got here, changing 2498 to 2497 is enough to avoid the memory issue).

-mental

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 10, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/6 "2007-04-10T21:57:11Z")

</div>

On 4/10/07, MenTaLguY [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> EOS
> 
> We know that it’s happening at parse-time rather than run-time, because the out-of-memory error occurs before Ruby has a chance to complain that ‘x’ is undefined.
> 
> In short, the Ruby parser apparently cannot cope with case statements which have more than 2498 branches (at least with the build of Ruby I’ve got here, changing 2498 to 2497 is enough to avoid the memory issue).

Probably hitting a lex/yacc semantic stack limit.

I wonder if you could do the same kind of thing with a  
begin/rescue/ensure/end clause?

Hmmm …

eval \<\<EOS  
begin  
raise  
#{ (0…1999).map { “rescue;\n” }.join(‘’) }  
end  
EOS

(eval):2003: compile error (SyntaxError)  
(eval):2003: memory exhausted

Sure enough! But it only took 1999 rescue clauses. 1998 does not  
cause it to happen.

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 11, 2007, 9:19pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/7 "2007-04-11T21:19:38Z")

</div>

Hi,

At Wed, 11 Apr 2007 04:56:23 +0900,  
Tim P. wrote in [ruby-talk:247418]:

> Probably hitting a lex/yacc semantic stack limit.

Yes, it will work by increasing YYMAXDEPTH.

> EOS
> 
> (eval):2003: compile error (SyntaxError)  
> (eval):2003: memory exhausted

A patch to inverse the order of shift/reduce.

# Index: parse.y

— parse.y (revision 12169)  
+++ parse.y (working copy)  
@@ -273,5 +273,5 @@ static void top\_local\_setup();  
%type bodystmt compstmt stmts stmt expr arg primary command  
command\_call method\_call  
%type expr\_value arg\_value primary\_value  
-%type if\_tail opt\_else case\_body cases opt\_rescue exc\_list  
exc\_var opt\_ensure  
+%type if\_tail opt\_else case\_body cases opt\_rescue rescue  
exc\_list exc\_var opt\_ensure  
%type args when\_args call\_args call\_args2 open\_args paren\_args  
opt\_paren\_args  
%type command\_args aref\_args opt\_block\_arg block\_arg var\_ref  
var\_lhs  
@@ -376,5 +376,7 @@ bodystmt : compstmt  
$$ = $1;  
if ($2) {

- 

```
     $$ = NEW_RESCUE($1, $2, $3);

```

- 

```
     $$ = $2;

```

- 

```
     $$->nd_head = $1;

```

- 

```
     $$->nd_else = $3;
 }
 else if ($3) {

```

@@ -1599,14 +1601,16 @@ primary : literal  
}  
}

- | kCASE expr\_value opt\_terms
- 

```
 case_body

```

- 

```
 kEND

```

- | kCASE expr\_value opt\_terms cases opt\_else kEND  
{

- 

```
 $$ = NEW_CASE($2, $4);

```

- 

```
 $4->nd_head->nd_next = $5;

```

- 

```
 $4->nd_head = $2;

```

- 

```
 $$ = $4;
       fixpos($$, $2);
   }

```

- | kCASE opt\_terms case\_body kEND

- | kCASE opt\_terms cases opt\_else kEND  
{

- 

```
 $$ = $3;

```

- 

```
 $3->nd_head->nd_next = $4;

```

- 

```
 $$ = $3->nd_body;

```

- 

```
 rb_gc_force_recycle((VALUE)$3);
   }

```

| kCASE opt\_terms kELSE compstmt kEND  
@@ -1871,7 +1875,6 @@ brace\_block : ‘{’  
case\_body : kWHEN when\_args then  
compstmt

- 

```
 cases
   {

```

- 

```
 $$ = NEW_WHEN($2, $4, $5);

```

- 

```
 $$ = NEW_WHEN($2, $4, 0);
   }

```

;  
@@ -1887,11 +1890,34 @@ when\_args : args  
;

-cases : opt\_else

- | case\_body  
+cases : case\_body

- 

```
   {

```

- 

```
 $$ = NEW_CASE($1, $1);

```

- 

```
   }

```

- | cases
- 

```
 case_body

```

- 

```
   {

```

- 

```
 $$ = $1;

```

- 

```
 $$->nd_head->nd_next = $2;

```

- 

```
 $$->nd_head = $2;

```

- 

```
   }

```

- ;
- 

+opt\_rescue : none

- | opt\_rescue
- 

```
 rescue

```

- 

```
   {

```

- 

```
 if ($1) {

```

- 

```
     $1->nd_head->nd_head = $$;

```

- 

```
     $1->nd_head = $$;

```

- 

```
     $$ = $1;

```

- 

```
 }

```

- 

```
 else {

```

- 

```
     $$ = NEW_RESCUE($2, $2, 0);

```

- 

```
 }

```

- 

```
   }

```

;

-opt\_rescue : kRESCUE exc\_list exc\_var then  
+rescue : kRESCUE exc\_list exc\_var then  
compstmt

- 

```
 opt_rescue
   {
       if ($3) {

```

@@ -1899,8 +1925,7 @@ opt\_rescue : kRESCUE exc\_list exc\_var th  
$5 = block\_append($3, $5);  
}

- 

```
 $$ = NEW_RESBODY($2, $5, $6);

```

- 

```
 $$ = NEW_RESBODY($2, $5, 0);
       fixpos($$, $2?$2:$5);
   }

```

- | none  
;

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 12, 2007, 5:31am UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/8 "2007-04-12T05:31:14Z")

</div>

Hi,

At Thu, 12 Apr 2007 04:19:02 +0900,  
Nobuyoshi N. wrote in [ruby-talk:247527]:

> A patch to inverse the order of shift/reduce.

And for if/elsif/else.

# Index: parse.y

— parse.y (revision 12169)  
+++ parse.y (working copy)  
@@ -273,5 +273,5 @@ static void top\_local\_setup();  
%type bodystmt compstmt stmts stmt expr arg primary command  
command\_call method\_call  
%type expr\_value arg\_value primary\_value  
-%type if\_tail opt\_else case\_body cases opt\_rescue exc\_list  
exc\_var opt\_ensure  
+%type if\_then opt\_else case\_body cases opt\_rescue exc\_list  
exc\_var opt\_ensure  
%type args when\_args call\_args call\_args2 open\_args paren\_args  
opt\_paren\_args  
%type command\_args aref\_args opt\_block\_arg block\_arg var\_ref  
var\_lhs  
@@ -1553,11 +1553,9 @@ primary : literal  
fixpos($$, $1);  
}

- | kIF expr\_value then
- 

```
 compstmt

```

- 

```
 if_tail

```

- 

```
 kEND

```

- | if\_then opt\_else kEND  
{

- 

```
 $$ = NEW_IF(cond($2), $4, $5);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $1->nd_else->nd_else = $2;

```

- 

```
 $$ = $1->nd_body;

```

- 

```
 rb_gc_force_recycle((VALUE)$1);
 if (cond_negative(&$$->nd_cond)) {
           NODE *tmp = $$->nd_body;

```

@@ -1744,18 +1742,26 @@ do : term  
;

-if\_tail : opt\_else

- | kELSIF expr\_value then
- 

```
 compstmt

```

- 

```
 if_tail

```

+opt\_else : none

- | kELSE compstmt  
{

- 

```
 $$ = NEW_IF(cond($2), $4, $5);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $$ = $2;
   }

```

;

-opt\_else : none

- | kELSE compstmt  
+if\_then : kIF expr\_value then

- 

```
 compstmt
   {

```

- 

```
 $$ = $2;

```

- 

```
 $$ = NEW_IF(cond($2), $4, 0);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $$ = NEW_IF(0, $$, $$);

```

- 

```
   }

```

- | if\_then kELSIF expr\_value then
- 

```
 compstmt

```

- 

```
   {

```

- 

```
 NODE *elsif = NEW_IF(cond($3), $5, 0);

```

- 

```
       fixpos(elsif, $3);

```

- 

```
 $$ = $1;

```

- 

```
 $$->nd_else->nd_else = elsif;

```

- 

```
 $$->nd_else = elsif;
   }

```

;

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 12, 2007, 9:05am UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/9 "2007-04-12T09:05:30Z")

</div>

On 12.04.2007 05:30, Nobuyoshi N. wrote:

> At Thu, 12 Apr 2007 04:19:02 +0900,  
> Nobuyoshi N. wrote in [ruby-talk:247527]:
> 
> > A patch to inverse the order of shift/reduce.
> 
> And for if/elsif/else.

But what do we gain by this? I haven’t seen this error in years of Ruby  
(neither in my own code nor in postings here) which leads me to believe  
that it’s actually not an issue in practice. The test case seemed  
extremely artificial and I guess CASE statements of that size are quite  
a lot more inefficient than Hash lookups or other strategies.

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 12, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/10 "2007-04-12T16:44:28Z")

</div>

On 4/12/07, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> extremely artificial and I guess CASE statements of that size are quite  
> a lot more inefficient than Hash lookups or other strategies.

Agreed. This is definitely and edge case that would only show up in  
some very poor code – mainly auto-generated stuff as shown by all the  
examples. I simply wanted to figure out if it was really a lex/yacc  
limit, then does it appear in other Ruby control structures.

Quite frankly I’m amazed that Nobu came up with a patch so quickly.  
The lexer instills fear into my heart.

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 13, 2007, 8:51am UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/11 "2007-04-13T08:51:12Z")

</div>

On 12.04.2007 17:58, MenTaLguY wrote:

> On Thu, 12 Apr 2007 16:05:05 +0900, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > But what do we gain by this?
> 
> Eh, a little bit of correctness, I guess. It’s probably best if the parser can handle anything which is syntactically valid Ruby, even if it’s a bit dumb.

I think it’s worth the effort only if a) it really accepts “unlimited”  
cases and b) it doesn’t cost performance. (Haven’t checked either)

> (an alternative would be to actually have an explicit limit on the number of ‘when’ or ‘rescue’ branches in the grammar)

Yep.

robert

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 12, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/12 "2007-04-12T17:59:35Z")

</div>

On Thu, 12 Apr 2007 16:05:05 +0900, Robert K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> But what do we gain by this?

Eh, a little bit of correctness, I guess. It’s probably best if the  
parser can handle anything which is syntactically valid Ruby, even if  
it’s a bit dumb.

(an alternative would be to actually have an explicit limit on the  
number of ‘when’ or ‘rescue’ branches in the grammar)

> I guess CASE statements of that size are quite a lot more inefficient  
> than Hash lookups or other strategies.

Yes, case statements in Ruby are a linear search. So too for rescue  
clauses.

-mental

---

<div class="post-metadata">

**Author:** ![sunsnow8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@sunsnow8](https://www.ruby-forum.com/u/sunsnow8)\
**Post date:** [April 21, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/memory-exhausted/91581/13 "2007-04-21T16:02:14Z")

</div>

Hi,

At Fri, 13 Apr 2007 15:50:11 +0900,  
Robert K. wrote in [ruby-talk:247769]:

> I think it’s worth the effort only if a) it really accepts “unlimited”  
> cases and b) it doesn’t cost performance. (Haven’t checked either)

In this case, yes for a, and almost yes for b, I guess.

Since there was a typo in [ruby-talk:247527], merged patch of  
[ruby-talk:247527] and [ruby-talk:247595].

# Index: parse.y

— parse.y (revision 12203)  
+++ parse.y (working copy)  
@@ -273,5 +273,5 @@ static void top\_local\_setup();  
%type bodystmt compstmt stmts stmt expr arg primary command  
command\_call method\_call  
%type expr\_value arg\_value primary\_value  
-%type if\_tail opt\_else case\_body cases opt\_rescue exc\_list  
exc\_var opt\_ensure  
+%type if\_then opt\_else case\_body cases opt\_rescue rescue  
exc\_list exc\_var opt\_ensure  
%type args when\_args call\_args call\_args2 open\_args paren\_args  
opt\_paren\_args  
%type command\_args aref\_args opt\_block\_arg block\_arg var\_ref  
var\_lhs  
@@ -376,5 +376,7 @@ bodystmt : compstmt  
$$ = $1;  
if ($2) {

- 

```
     $$ = NEW_RESCUE($1, $2, $3);

```

- 

```
     $$ = $2;

```

- 

```
     $$->nd_head = $1;

```

- 

```
     $$->nd_else = $3;
 }
 else if ($3) {

```

@@ -1553,11 +1555,9 @@ primary : literal  
fixpos($$, $1);  
}

- | kIF expr\_value then
- 

```
 compstmt

```

- 

```
 if_tail

```

- 

```
 kEND

```

- | if\_then opt\_else kEND  
{

- 

```
 $$ = NEW_IF(cond($2), $4, $5);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $1->nd_else->nd_else = $2;

```

- 

```
 $$ = $1->nd_body;

```

- 

```
 rb_gc_force_recycle((VALUE)$1);
 if (cond_negative(&$$->nd_cond)) {
           NODE *tmp = $$->nd_body;

```

@@ -1599,14 +1599,16 @@ primary : literal  
}  
}

- | kCASE expr\_value opt\_terms
- 

```
 case_body

```

- 

```
 kEND

```

- | kCASE expr\_value opt\_terms cases opt\_else kEND  
{

- 

```
 $$ = NEW_CASE($2, $4);

```

- 

```
 $4->nd_head->nd_next = $5;

```

- 

```
 $4->nd_head = $2;

```

- 

```
 $$ = $4;
       fixpos($$, $2);
   }

```

- | kCASE opt\_terms case\_body kEND

- | kCASE opt\_terms cases opt\_else kEND  
{

- 

```
 $$ = $3;

```

- 

```
 $3->nd_head->nd_next = $4;

```

- 

```
 $$ = $3->nd_body;

```

- 

```
 rb_gc_force_recycle((VALUE)$3);
   }

```

| kCASE opt\_terms kELSE compstmt kEND  
@@ -1744,18 +1746,26 @@ do : term  
;

-if\_tail : opt\_else

- | kELSIF expr\_value then
- 

```
 compstmt

```

- 

```
 if_tail

```

+opt\_else : none

- | kELSE compstmt  
{

- 

```
 $$ = NEW_IF(cond($2), $4, $5);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $$ = $2;
   }

```

;

-opt\_else : none

- | kELSE compstmt  
+if\_then : kIF expr\_value then

- 

```
 compstmt
   {

```

- 

```
 $$ = $2;

```

- 

```
 $$ = NEW_IF(cond($2), $4, 0);

```

- 

```
       fixpos($$, $2);

```

- 

```
 $$ = NEW_IF(0, $$, $$);

```

- 

```
   }

```

- | if\_then kELSIF expr\_value then
- 

```
 compstmt

```

- 

```
   {

```

- 

```
 NODE *elsif = NEW_IF(cond($3), $5, 0);

```

- 

```
       fixpos(elsif, $3);

```

- 

```
 $$ = $1;

```

- 

```
 $$->nd_else->nd_else = elsif;

```

- 

```
 $$->nd_else = elsif;
   }

```

;  
@@ -1871,7 +1881,6 @@ brace\_block : ‘{’  
case\_body : kWHEN when\_args then  
compstmt

- 

```
 cases
   {

```

- 

```
 $$ = NEW_WHEN($2, $4, $5);

```

- 

```
 $$ = NEW_WHEN($2, $4, 0);
   }

```

;  
@@ -1887,11 +1896,34 @@ when\_args : args  
;

-cases : opt\_else

- | case\_body  
+cases : case\_body

- 

```
   {

```

- 

```
 $$ = NEW_CASE($1, $1);

```

- 

```
   }

```

- | cases
- 

```
 case_body

```

- 

```
   {

```

- 

```
 $$ = $1;

```

- 

```
 $$->nd_head->nd_next = $2;

```

- 

```
 $$->nd_head = $2;

```

- 

```
   }

```

;

-opt\_rescue : kRESCUE exc\_list exc\_var then  
+opt\_rescue : none

- | opt\_rescue
- 

```
 rescue

```

- 

```
   {

```

- 

```
 if ($1) {

```

- 

```
     $1->nd_head->nd_head = $2;

```

- 

```
     $1->nd_head = $2;

```

- 

```
     $$ = $1;

```

- 

```
 }

```

- 

```
 else {

```

- 

```
     $$ = NEW_RESCUE($2, $2, 0);

```

- 

```
 }

```

- 

```
   }

```

- ;
- 

+rescue : kRESCUE exc\_list exc\_var then  
compstmt

- 

```
 opt_rescue
   {
       if ($3) {

```

@@ -1899,8 +1931,7 @@ opt\_rescue : kRESCUE exc\_list exc\_var th  
$5 = block\_append($3, $5);  
}

- 

```
 $$ = NEW_RESBODY($2, $5, $6);

```

- 

```
 $$ = NEW_RESBODY($2, $5, 0);
       fixpos($$, $2?$2:$5);
   }

```

- | none  
;

@@ -6109,4 +6140,5 @@ rb\_id2name(id)  
{  
char \*name;

- st\_data\_t data;

- if (st\_lookup(sym\_rev\_tbl, id, (st\_data\_t \*)&name))
- return name;

- if (st\_lookup(sym\_rev\_tbl, id, &data))

- return (char \*)data;

- while (n = \*prev) {

- while ((n = \*prev) != 0) {  
if (n-\>u1.node == ptr) {  
\*prev = n-\>u2.node;
