New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very misleading line number for warnings in some cases #16574
Comments
From sdewey@factset.comCreated by sdewey@factset.comI have provided a full description of the bug on StackOverflow For convenience, here is what I wrote there: use strict; my $choice = 0; while ($choice == 0){ #Pretend the user provided this via STDIN if ($choice eq '-4'){ When you run this, you will get the warning message Argument "5,6,7" isn't numeric in numeric eq (==) at example.pl line 11. But line 11 corresponds to the line if ($choice eq '-4'){ which cannot possibly cause this warning message because it does not contain a numeric comparison. It seems what's actually happening is that Perl advances to the next comparison, while ($choice == 0){, but the line counter used for the warning message does not advance. What makes this particular case worse is that, since the "bad" comparison is the loop condition, it is actually far away from the provided line. In my (pre-simplification) script, it was hundreds of lines away from the provided line number. Is this a bug or just an unfortunate limitation of the parser? Perl Info
|
From @GrinnzI can reproduce on 5.26.2. |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Fri, Jun 01, 2018 at 03:22:18PM -0700, Stephen E. Dewey (via RT) wrote:
It's a well-known limitation that needs to be addressed at some point. -- |
From @rockyOn Tue, Jun 19, 2018 at 4:36 AM, Dave Mitchell <davem@iabyn.com> wrote:
The fact that it is a well-known limitation that has existed since, is it There is perhaps another, possibly less intrusive way, that this might be At the point of error Perl knows what instruction it was working on. I have been working on a deparser that will show you at runtime where you trepan.pl /tmp/bug.pl #4: my $choice = 0; Notice that you not only get the text of the line but also where in the while ($choice == 0 && $i_feel_pretty == 3) { the deparsing would indicate *which *of the two conditions had the problem,
|
From @rockyApparently, I wasn't clear in describing what I was proposing. There were 1. A suggstion to add some sort of mechanism whereby a user can write a Let me elaborate a little on 1. Currently Perl has an END block which is close, but has a couple of But if this were fixed, how would we get the "Illegal division by zero" On Tue, Jun 19, 2018 at 5:20 PM, Rocky Bernstein <rocky.bernstein@gmail.com>
|
From @iabynOn Wed, Jun 20, 2018 at 06:15:25AM -0400, Rocky Bernstein wrote:
I don't understand what END blocks have to do with this. On the other hand, the pre-existing $SIG{__WARN__} and $SIG{__DIE__} sound Perhaps perl should set an interpreter variable, PL_warn_err_op, say, before PS I'm assuming you're not suggesting that perl itself does (2)? -- |
From @rockyOn Wed, Jun 20, 2018 at 7:28 AM, Dave Mitchell <davem@iabyn.com> wrote:
That would be fantastic.
I don't want to get sidetracked on this. More important to the community |
From @ikegamiOn Tue, Jun 19, 2018 at 4:36 AM, Dave Mitchell <davem@iabyn.com> wrote:
It's the nextstate ops that record the line numbers, right? Couldn't one be |
From @rockyOn Wed, Jun 20, 2018 at 5:19 PM, Eric Brine <ikegami@adaelis.com> wrote:
Yes, I believe so.
Proably - why not make the modification and let us know if that fixes Note though that in https://stackoverflow.com/a/50651543/546218 another That said, I think it was Reini Urban who mentioned that adding One of the cool things about using this novel decompilation at runtime Given the historical baggage of Perl and the environment that a large |
Migrated from rt.perl.org#133239 (status was 'open')
Searchable as RT133239$
The text was updated successfully, but these errors were encountered: