summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-10-31 21:57:28 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-11-13 04:49:36 -0800
commit04bae31374e4aa02ef4389cc3484ac2558056857 (patch)
treeaf869b37ee042cb56697cf7cecdfb65b1e569221 /op.c
parenta63556160924a497d8ad70cda2f162316ff10cfc (diff)
downloadperl-04bae31374e4aa02ef4389cc3484ac2558056857.tar.gz
Don’t attempt to inline my sub (){$outer_var}
$ perl5.18.2 -Ilib -Mfeature=lexical_subs -e ' my $x; my sub a(){$x}; print a' The lexical_subs feature is experimental at -e line 1. Segmentation fault: 11 Same in blead. When calls to the sub are compiled (the ‘a’ in ‘print a’) the value of the lexical variable cannot possibly known, because the sub hasn’t been cloned yet, and all we have is the closure prototype. A potentially constant closure prototype is marked CvCONST and cv_const_sv_or_av (called by the code in toke.c that handles bare- words) thinks that CvCONST means we have a constant XSUB. Only lexi- cal subs allow a closure prototype to reach that function. We shouldn’t mark the closure prototype as CvCONST to begin with. Because when we do, the ‘constant’ is retrieved from CvXUBANY, which is a union shared by CvSTART. Then toke.c does SvREFCNT_inc on CvSTART, and screws up the op tree.
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/op.c b/op.c
index 10a0c02960..30f1a2c330 100644
--- a/op.c
+++ b/op.c
@@ -8085,12 +8085,6 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
pad_tidy(CvCLONE(cv) ? padtidy_SUBCLONE : padtidy_SUB);
- if (CvCLONE(cv)) {
- assert(!CvCONST(cv));
- if (ps && !*ps && op_const_sv(block, cv))
- CvCONST_on(cv);
- }
-
attrs:
if (attrs) {
/* Need to do a C<use attributes $stash_of_cv,\&cv,@attrs>. */