This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
205fcd8
)
make RC-stack-aware: S_fold_constants()
author
David Mitchell
<davem@iabyn.com>
Thu, 5 Jan 2023 11:37:23 +0000
(11:37 +0000)
committer
David Mitchell
<davem@iabyn.com>
Wed, 16 Aug 2023 16:16:59 +0000
(17:16 +0100)
The folded SV it pops off the stack should be treated as
reference counted.
op.c
patch
|
blob
|
blame
|
history
diff --git
a/op.c
b/op.c
index
e672b16
..
37eb058
100644
(file)
--- a/
op.c
+++ b/
op.c
@@
-4969,7
+4969,11
@@
S_fold_constants(pTHX_ OP *const o)
switch (ret) {
case 0:
- sv = *(PL_stack_sp--);
+ sv = *PL_stack_sp;
+ if (rpp_stack_is_rc())
+ SvREFCNT_dec(sv);
+ PL_stack_sp--;
+
if (o->op_targ && sv == PAD_SV(o->op_targ)) { /* grab pad temp? */
pad_swipe(o->op_targ, FALSE);
}