nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

CvCVGV_RC assert when defining a subroutine at runtime over empty prototype #289

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

> perlcc -r -e 'no warnings; sub z_zwap (&); print qq{ok\n} if eval q{sub 
z_zwap {return @_}; 1;}'
a.out: op.c:6279: Perl_newATTRSUB: Assertion `!(((XPVCV*)({ void *_p = 
((cv)->sv_any); _p; }))->xcv_flags & 0x0400)' failed

What is the expected output? What do you see instead?

> perl -e 'no warnings; sub z_zwap (&); print qq{ok\n} if eval q{sub z_zwap 
{return @_}; 1;}'
ok

Please use labels and text to provide additional information.

same issue without the 'no warnings'

Original issue reported on code.google.com by nicolas....@gmail.com on 6 Feb 2014 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by todd.e.rinaldo on 6 Feb 2014 at 8:52

GoogleCodeExporter commented 9 years ago

Original comment by todd.e.rinaldo on 6 Feb 2014 at 8:53

GoogleCodeExporter commented 9 years ago
similar issue with

> perlcc -r -e 'my $r; { packageBEGIN { $r = \&main::whack; }::whack; }; print 
ref $r; eval q/sub whack {}; \&whack/; print ref $r;'
a.out: op.c:6279: Perl_newATTRSUB: Assertion `!(((XPVCV*)({ void *_p = 
((cv)->sv_any); _p; }))->xcv_flags & 0x0400)' failed.

> perl -e 'my $r; { package bloop; BEGIN { $r = \&main::whack; } }; print ref 
$r; eval q/sub whack {}; \&whack/; print ref $r;'
CODECODE

Original comment by nicolas....@gmail.com on 6 Feb 2014 at 9:04

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 6 Feb 2014 at 11:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 7 Feb 2014 at 8:33

GoogleCodeExporter commented 9 years ago
=> Medium and rather obscure bug. Nowhere used
Need to attach magic_backref to such GVs

Original comment by reini.urban on 7 Feb 2014 at 8:34

GoogleCodeExporter commented 9 years ago
Done and fixed with commit efa42cf0fdf4a0f9ee6a154aee51e9c5d358448f
Author: Reini Urban <rurban@cpanel.net>
Date:   Fri Feb 7 15:24:22 2014 -0600

    C: fix #289, add GV->CV backref magic

    simplify CvFLAGS handling to filter out CVf_DYNFILE and CVf_CVGV_RC
    fix too high REFCNT for CVs (cross-checked with pure-perl)
    run-time CvCVGV_RC_off for backref magic CVs

    now we have new cv_undef failures to investigate (perlio, attributes, ...)

Original comment by reini.urban on 7 Feb 2014 at 9:24