bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Warning message issued with no source line number [PATCH]


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Warning message issued with no source line number [PATCH]
Date: Wed, 17 May 2017 13:41:49 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, May 16, 2017 at 11:34:25PM -0400, Peter J. Farley III wrote:
> > Here's a simpler version:
> > 
> > bash-4.2$ cat /tmp/test.awk
> > BEGIN {
> >       "a" 1
> > }
> > bash-4.2$ gawk --lint -f /tmp/test.awk
> > gawk: warning: statement may have no effect
> > 
> > Interestingly, if the "1" is removed, there is no warning at all:
> > 
> > bash-4.2$ cat /tmp/test.awk
> > BEGIN {
> >       "a"
> > }
> > bash-4.2$ gawk --lint -f /tmp/test.awk
> > bash-4.2$
> > 
> > But still we need to find the bug...
> 
> Interesting bug.  Thanks for the update.

The problem is due to an Op_concat instruction that has source_line set to 0.
The message printed by msg.c:err includes the source filename and line only if
sourceline is positive. The attached patch seems to fix this particular
problem, but it seems like a bit of a hack. I await confirmation from Arnold
that this is the right way to solve this issue.

Regards,
Andy

Attachment: concat-srcline.patch
Description: Text document


reply via email to

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