Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [perl #60954] warnings from while() condition are reported from wrong line

1 view
Skip to first unread message

Tim Bunce

unread,
Dec 2, 2008, 5:56:42 AM12/2/08
to Rafael Garcia-Suarez via RT, Tim....@pobox.com
On Tue, Dec 02, 2008 at 01:05:26AM -0800, Rafael Garcia-Suarez via RT wrote:
> 2008/12/1 via RT Tim Bunce <perlbug-...@perl.org>:
> > After executing the last statement in a while() block perl doesn't
> > update its concept of the current line number when it evaluates the
> > while condition. So any warnings generated by the condition are
> > reported as being from whatever line was last executed within the block:
>
> Maybe the same trick that I used in change 33710 can be used there. It
> has no run-time impact except a little more memory used for an extra
> null op.
>
> Change 33710 by rgs@stcosmo on 2008/04/18 10:42:17
>
> Fix the line-number-in-elsif longstanding bug.
> This patch does two things :
> - newSTATEOP now nullifies the state op it
> just created if OPf_SPECIAL is passed to it
> in flags
> - the parser now inserts a nullified stateop
> in the expression block of an elsif

Sounds plausible.

How does that actually work though?

Googling that change led me to the old discussion, including some
TODO tests that cover the same problem as this bug:
http://www.nntp.perl.org/group/perl.perl5.porters/2008/04/msg136236.html

Tim.

Nicholas Clark

unread,
Mar 25, 2009, 6:17:59 AM3/25/09
to Tim Bunce, Rafael Garcia-Suarez via RT

I *think* (but don't quote me on that), that:

Line numbers in errors reports are calcuated by S_closest_cop() in util.c.
It treats STATEOPs and nullified STATEOPs equally, walking the compile-time
generated optree to do this.

However, something else (not sure what) must be reporting line numbers based
on PL_curcop, which is set at run time by pp_nextstate. That, of course, is
not invoked for nullified STATEOPs, just real STATEOPs.


So I infer that this is a bit of a hack to find a way of storing a line
number that one can see, and the other can not.

Nicholas Clark

Rafael Garcia-Suarez

unread,
Mar 25, 2009, 6:50:59 AM3/25/09
to Tim Bunce, perl5-porters
2009/3/25 Nicholas Clark <ni...@ccl4.org>:

Both warnings and errors go through Perl_vmess. The line number found
by closest_cop depends on the last cop executed (PL_curcop). That
should explain why the warning is not reported from the same point at
the first and subsequent iterations of the loop. The first time,
PL_curcop points at the ";" before the while; the next times, at the
";" after the last statement of the while (in a figured way). A
nullified stateop after the enterloop is likely to solve this.

Tim Bunce

unread,
Nov 27, 2009, 6:03:11 AM11/27/09
to perl5-...@perl.org
On Mon, Dec 01, 2008 at 03:07:42AM -0800, Tim Bunce wrote:
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60954 >

This is still open (and affecting NYTProf).

Any chance it could be fixed for 5.12?

Tim.

Jesse

unread,
Nov 27, 2009, 1:17:46 PM11/27/09
to Tim Bunce, perl5-...@perl.org

At least for now, I've added this to the blocks-5.12 list

Tim Bunce

unread,
Dec 22, 2009, 3:09:34 PM12/22/09
to jesse, Tim Bunce, perl5-...@perl.org

Any news on this one?

Tim.

Nicholas Clark

unread,
Dec 23, 2009, 10:16:51 AM12/23/09
to Tim Bunce, jesse, perl5-...@perl.org

To the best of my knowledge, "no". (I think that Jesse would be the best
person to answer this, but I believe that he's currently indisposed,
visiting relatives, and I'm not sure for how long.)


At various times the list has been pleasantly surprised by patches appearing
from various (thank-you) individuals to fix various open bugs, but no-one is
jumping up to volunteer to systematically work through and solve the bugs on
the list of blockers.

(I certainly don't have time)

For many of the bugs, it's a skilled job to diagnose and fix them.

A job.

Nicholas Clark

Dave Mitchell

unread,
Jan 11, 2010, 6:04:03 PM1/11/10
to Tim Bunce, jesse, perl5-...@perl.org
On Wed, Dec 23, 2009 at 03:16:51PM +0000, Nicholas Clark wrote:
> > > > This is still open (and affecting NYTProf).
> > > >
> > > > Any chance it could be fixed for 5.12?
> > >
> > > At least for now, I've added this to the blocks-5.12 list

I can't really see that this is a 5.12 showstopper.

It's present in 5.8.x, and is just one of a whole class of bugs wherein
perl misreports line numbers. It really needs fixing as part of a general
post-5.12 overhaul of the line number reporting system, rather than
throwing another one-off hack at it.


--
I've often wanted to drown my troubles, but I can't get my wife to go
swimming.

James E Keenan via RT

unread,
Apr 20, 2012, 9:03:49 PM4/20/12
to perl5-...@perl.org
On Mon Jan 11 15:04:29 2010, davem wrote:
> On Wed, Dec 23, 2009 at 03:16:51PM +0000, Nicholas Clark wrote:
> > > > > This is still open (and affecting NYTProf).
> > > > >
> > > > > Any chance it could be fixed for 5.12?
> > > >
> > > > At least for now, I've added this to the blocks-5.12 list
>
> I can't really see that this is a 5.12 showstopper.
>
> It's present in 5.8.x, and is just one of a whole class of bugs wherein
> perl misreports line numbers. It really needs fixing as part of a general
> post-5.12 overhaul of the line number reporting system, rather than
> throwing another one-off hack at it.
>
>

Was this overhaul of the line number operating system ever undertaken?

Thank you very much.
Jim Keenan


---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=60954

Father Chrysostomos via RT

unread,
Apr 21, 2012, 1:29:23 AM4/21/12
to perl5-...@perl.org
On Fri Apr 20 18:03:49 2012, jkeenan wrote:
> On Mon Jan 11 15:04:29 2010, davem wrote:
> > On Wed, Dec 23, 2009 at 03:16:51PM +0000, Nicholas Clark wrote:
> > > > > > This is still open (and affecting NYTProf).
> > > > > >
> > > > > > Any chance it could be fixed for 5.12?
> > > > >
> > > > > At least for now, I've added this to the blocks-5.12 list
> >
> > I can't really see that this is a 5.12 showstopper.
> >
> > It's present in 5.8.x, and is just one of a whole class of bugs wherein
> > perl misreports line numbers. It really needs fixing as part of a
general
> > post-5.12 overhaul of the line number reporting system, rather than
> > throwing another one-off hack at it.
> >
> >
>
> Was this overhaul of the line number operating system ever undertaken?

I don’t think so.

--

Father Chrysostomos
0 new messages