bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] bug related to hash function


From: arnold
Subject: Re: [bug-gawk] bug related to hash function
Date: Tue, 10 May 2016 08:24:59 -0600
User-agent: Heirloom mailx 12.4 7/29/08

> > May I add your test program and a few lines from the data file to
> > the test suite?
>
> Sure !

Great, thanks.

> What was the problem finally? From the comment I understand that the 
> index became an integer causing (I guess) some kind of wrong table in a 
> hash table or something?

The data came originally from a field, which is a string unless asked
to act like a number (BIG generalization, but let's not worry about that for
now).

Gawk uses reference counted strings, so the array index continued to point
at the original field, with the indicator that maybe it's really a number.

But array indices are really ONLY strings. With the flag set, when the
program compared the value to 0 (around line 61 or 62 in your program),
it got converted from "0000177060" (or whatever it was) to 177060 and
then used as "177060" to index the array. The latter string was not there.
:-(

The gawk dev team is starting to review how this kind of thing is
handled inside the interpreter; we know that there are some issuses
that need working on.

In the meantime, you can use this patch, and I will soon add your program
to the test suite, and push the fix out.

Thanks,

Arnold



reply via email to

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