Since they are created in the peephole optimizer, multideref ops have to
rely on getting the lexical scope hints from their first kid. It might have
happened that the kid of one such op was a gv op compiled in the scope of
the pragma, and was then reused outside of the scope of the pragma again
as the first kid of another multideref op. In that case, the multideref op
was wrongly replaced. This is solved by always clearing gv ops entries in
ck_rv2xv() from the global op map.
This solves random failures of test 12 from t/40-scope.t.
}
o = old_ck(aTHX_ o);
- if (hint & A_HINT_DO) {
#if A_HAS_MULTIDEREF
- if (old_ck == a_old_ck_rv2sv && o->op_flags & OPf_KIDS) {
- OP *kid = cUNOPo->op_first;
- if (kid && kid->op_type == OP_GV)
+ if (old_ck == a_old_ck_rv2sv && o->op_flags & OPf_KIDS) {
+ OP *kid = cUNOPo->op_first;
+ if (kid && kid->op_type == OP_GV) {
+ if (hint & A_HINT_DO)
a_map_store(kid, kid->op_ppaddr, NULL, hint);
+ else
+ a_map_delete(kid);
}
+ }
#endif
+
+ if (hint & A_HINT_DO) {
a_map_store_root(o, o->op_ppaddr, hint);
o->op_ppaddr = a_pp_deref;
} else