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
while each %$ref clobbers @_ in some circumstances #13734
Comments
From @demerphqCreated by @demerphqThe following should print "ok". The triggers seems to be the perl -le' Perl Info
|
From @wolfsageBisect (seems plausible): bad - non-zero exit from ./perl -Ilib -e t(["foo"],sub { my $got= Make while(each ...) imply defined($_ = ...) This came up in ticket #108286. ... -- Matthew Horsfall (alh) |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 13 April 2014 21:41, Matthew Horsfall (alh) <wolfsage@gmail.com> wrote:
Yeah, reverting this patch fixes the problem. Yves -- |
From @demerphqOn 13 April 2014 22:27, demerphq <demerphq@gmail.com> wrote:
With that patch reverted but then rewriting the while loop to apply $ ./perl -le' -- |
From zefram@fysh.orgdemerphq wrote:
The bug is not in that commit. All that does is introduce a $ perl5.19.10 -le 'sub p { 1 while defined($_ = each %r); print $_[0] eq "foo" ? "ok" : "BUG"; } p($_) for @{["foo"]};' And it turns out it's not specific to each() at all. The essential part $ perl5.19.10 -le 'sub p { $_ = 123; print $_[0] eq "foo" ? "ok" : "BUG"; } p($_) for @{["foo"]};' With different print statements, we can reveal the real problem: $ perl5.19.10 -le 'sub p { print \$_[0], " ", $_[0]; $_ = 123; print \$_[0], " ", $_[0]; } p($_) for @{["foo"]};' The problem is that the test code is using $_ in conflicting ways. -zefram |
From @demerphqOn 13 April 2014 22:56, Zefram via RT <perlbug-followup@perl.org> wrote:
That code was fine until that commit. I claim that commit was a Yves -- |
From @ikegamiOn Sun, Apr 13, 2014 at 5:16 PM, demerphq <demerphq@gmail.com> wrote:
Yes, but was it an intentional or unintentional regression? I'm having |
From @ap* Eric Brine <ikegami@adaelis.com> [2014-04-14 03:20]:
In RT and in the archives, respectively: * demerphq <demerphq@gmail.com> [2014-04-13 23:20]:
Until that commit, the meaning of `while (each %foo) {...}` was “execute Is that *actually* what you *wanted* the code to do? Do you consider that way of writing it the clearest way to do it?
It clobbers @_ when $_ is aliased to a variable within @_, which you did use 5.010; This is a standard trap of the pass-as-alias nature of @_. -- |
From @demerphqOn 14 April 2014 13:29, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
Actually no, its not. Its the exact opposite. The problem comes Yves -- |
From zefram@fysh.orgThis has been determined not to be a bug. This ticket should be closed. -zefram |
@cpansprout - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#121646 (status was 'rejected')
Searchable as RT121646$
The text was updated successfully, but these errors were encountered: