bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] $0 reassignment corruption in 4.2


From: Andrew J. Schorr
Subject: Re: [bug-gawk] $0 reassignment corruption in 4.2
Date: Tue, 14 Nov 2017 10:38:32 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Nov 14, 2017 at 08:24:49AM -0700, address@hidden wrote:
> "Andrew J. Schorr" <address@hidden> wrote:
> 
> > On Tue, Nov 14, 2017 at 08:53:14AM -0500, Andrew J. Schorr wrote:
> > > Combined patch attached. Eric -- can you please confirm this fixes your 
> > > issue?
> > > 
> > > Arnold -- does this look right to you? I haven't chased down all the 
> > > nuances
> > > of what this assign function is doing...
> >
> > Note: we may have a similar ordering problem at debug.c:1301.
> >
> > And at interpret.h:373, I'm not sure how Op_field_spec_lhs really works and
> > what's going on with the field_assign value...
> >
> > -Andy
> 
> The change is probably right. But it should be commented as to what's
> going on and why the order is important.

Good point. How's this comment?

                        /* N.B. We must call assign() before unref, since
                         * we may need to copy $n values before freeing the
                         * $0 buffer.
                         */
                        assert(assign != NULL);
                        assign();
                        unref(*lhs);

> I'll take a look at the other two places you mention.

Thanks.

> Here there most definitely be dragons. Lots of them. :-)

Yes. I also have 2 test cases (attached) that I added to BASIC_TESTS. Does
that look OK?

Regards,
Andy

Attachment: setrec0.awk
Description: Text document

Attachment: setrec0.in
Description: Text document

Attachment: setrec0.ok
Description: Text document

Attachment: setrec1.awk
Description: Text document

Attachment: setrec1.ok
Description: Text document


reply via email to

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