Skip to content
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

Bizarre copy of HASH in reference constructor #13675

Open
p5pRT opened this issue Mar 18, 2014 · 5 comments
Open

Bizarre copy of HASH in reference constructor #13675

p5pRT opened this issue Mar 18, 2014 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 18, 2014

Migrated from rt.perl.org#121464 (status was 'open')

Searchable as RT121464$

@p5pRT
Copy link
Author

p5pRT commented Mar 18, 2014

From @greerga

Obviously these don't work (on anonymous subs at least), but ideally they
wouldn't give a perl interpreter internal error either. The "state" case
failure goes back to its introduction 5.10.0. Amusingly, the "my" case
'worked' (the first lexical was closed over in the END block) under 5.8.4
but not in 5.10.0 or later which had the bizarre copy error.

Examples run below are with recently-built blead branch​:
$ git describe
v5.19.9-192-g7d18793

$ ./miniperl -Ilib -wE 'eval q<sub { state %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

$ ./miniperl -Ilib -wE 'eval q<sub { my %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

For reference, giving the sub a name makes the "state" version work and
changes the "my" warning to​:
  Variable "%done" will not stay shared at (eval 1) line 1.
without the internal error.

--
George Greer

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @iabyn

On Tue, Mar 18, 2014 at 09​:35​:46AM -0700, George Greer wrote​:

Obviously these don't work (on anonymous subs at least), but ideally they
wouldn't give a perl interpreter internal error either. The "state" case
failure goes back to its introduction 5.10.0. Amusingly, the "my" case
'worked' (the first lexical was closed over in the END block) under 5.8.4
but not in 5.10.0 or later which had the bizarre copy error.

Examples run below are with recently-built blead branch​:
$ git describe
v5.19.9-192-g7d18793

$ ./miniperl -Ilib -wE 'eval q<sub { state %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

$ ./miniperl -Ilib -wE 'eval q<sub { my %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

For reference, giving the sub a name makes the "state" version work and
changes the "my" warning to​:
Variable "%done" will not stay shared at (eval 1) line 1.
without the internal error.

These appear to have been fixed sometime between 5.21.3 and 5.21.4.

--
No matter how many dust sheets you use, you will get paint on the carpet.

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @wolfsage

On Thu, Mar 26, 2015 at 8​:39 AM, Dave Mitchell <davem@​iabyn.com> wrote​:

On Tue, Mar 18, 2014 at 09​:35​:46AM -0700, George Greer wrote​:

$ ./miniperl -Ilib -wE 'eval q<sub { state %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

$ ./miniperl -Ilib -wE 'eval q<sub { my %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

For reference, giving the sub a name makes the "state" version work and
changes the "my" warning to​:
Variable "%done" will not stay shared at (eval 1) line 1.
without the internal error.

These appear to have been fixed sometime between 5.21.3 and 5.21.4.

According to a bisect this was fixed by​:

  commit e52eb89
  Author​: Father Chrysostomos <sprout@​cpan.org>
  Date​: Wed Sep 10 20​:29​:19 2014 -0700

  Avoid reifying GVs in rv2cv

  \&foo no longer reifies GVs in the stash​:

  $ ./miniperl -e 'sub foo{} warn $​::{foo}; \&amp;foo; warn $​::{foo}'
  CODE(0x7fab6282ad98) at -e line 1.
  CODE(0x7fab6282ad98) at -e line 1.

  Sub calls still reify them though, because of the way ck_subr cur-
  rently works.

  Constant proxies are still upgraded to full GVs for now, just to mini-
  mise the churn per patch.

  This makes it possible for OP_GVs to point to things other than GVs,
  and these things are stored in the pad under threads. Hence, pad_tidy
  could turn on PADTMP, and then IS_PADGV becomes true when it is
  upgraded to a glob, so refgen will fail assertions. There is actually
  no need to turn on PADTMP in pad_tidy, since it will already be on for
  op targets. (We need to get rid of IS_PADGV one of these days. It
  doesn’t actually do anything.)

-- Matthew Horsfall (alh)

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @cpansprout

On Thu Mar 26 06​:48​:25 2015, alh wrote​:

On Thu, Mar 26, 2015 at 8​:39 AM, Dave Mitchell <davem@​iabyn.com> wrote​:

On Tue, Mar 18, 2014 at 09​:35​:46AM -0700, George Greer wrote​:

$ ./miniperl -Ilib -wE 'eval q<sub { state %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

$ ./miniperl -Ilib -wE 'eval q<sub { my %done; END { \%done; } }>'
Variable "%done" is not available at (eval 1) line 1.
Bizarre copy of HASH in reference constructor at (eval 1) line 1.
END failed--call queue aborted.

For reference, giving the sub a name makes the "state" version work and
changes the "my" warning to​:
Variable "%done" will not stay shared at (eval 1) line 1.
without the internal error.

These appear to have been fixed sometime between 5.21.3 and 5.21.4.

According to a bisect this was fixed by​:

commit e52eb89
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Wed Sep 10 20​:29​:19 2014 -0700

Avoid reifying GVs in rv2cv

\\&foo no longer reifies GVs in the stash&#8203;:

I don’t see how that would have fixed it. It may be possible still to trigger the bug some other way.

--

Father Chrysostomos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants