bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Possible regression of SYMTAB


From: Assaf Gordon
Subject: Re: [bug-gawk] Possible regression of SYMTAB
Date: Wed, 7 Nov 2012 15:18:01 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Hello Aaron,

Thanks for the quick response.

Aharon Robbins wrote, On 11/07/2012 02:34 PM:
>>
>> Test case:
>> ===
>> $ printf "1\n2\n" | ./gawk '{SYMTAB["POS"]=1 ; print $POS}'
>> 1
>> gawk: cmd. line:1: (FILENAME=- FNR=2) fatal: internal error line 175, file: 
>> interpret.h
>> ===
> 
> It's a bug. The fix is below. I will push it into the repo sometime in
> the next few days, along with your test case.
> 
>> This works with 3.1.8, 4.0.1, and upto revision
>> eb2698f49247c94c84e1e2c2304ba94d96c89bc9 , but fails starting with
>> revision b9a82851866f84ca306a2802b4ca50089a2fe683 (which is aptly named
>> "First cut at SYMTAB and FUNCTAB.").
> 
> Actually, it only "works" in the 3.1.x and 4.0.x by accident. In those
> versions SYMTAB is not special and has no effect.
> 
> If you change the test case to
> 
>       echo a b | ./gawk '{SYMTAB["POS"]=2 ; print $POS}'
> 
> you should see the difference. :-)
> 
> If you don't understand what I mean then I'll explain in more detail.
> 

I see the difference, 
However, I'm not sure the patch fully fixes the issue.

Here's another test case (with your patch applied) - seems like the SYMTAB only 
works after the first line?
===
$ printf "1 a\n2 b\n" | ./gawk '{SYMTAB["POS"]=1 ; print $POS}'
1 a
2
===

and yet another, in which SYMTAB doesn't work at all:
===
$ printf "1 a\n2 b\n" | ./gawk 'BEGIN {SYMTAB["POS"]=1} {print $POS}'
1 a
2 b
===

and yet another strange thing:
===
$ ./gawk -d/dev/stderr 'BEGIN { SYMTAB["POS"]=1 }'
gawk: fatal error: internal error
Aborted
===
(whereas I would expect to see "POS: 1" as a valid variable).


Regards,
 -gordon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]