if $hr->{svclass} eq "IV" and $sv->FLAGS & SVf_IVisUV;
Carp::cluck("bad concise_sv: $sv") unless $sv and $$sv;
$hr->{svaddr} = sprintf("%#x", $$sv);
- if ($hr->{svclass} eq "GV") {
+ if ($hr->{svclass} eq "GV" && $sv->isGV_with_GP()) {
my $gv = $sv;
- my $stash = $gv->STASH->NAME;
- if ($stash eq "main") {
+ my $stash = $gv->STASH->NAME; if ($stash eq "main") {
$stash = "";
} else {
$stash = $stash . "::";
}
use OptreeCheck;
use Config;
-plan tests => 1;
+plan tests => 2;
SKIP: {
skip "no perlio in this build", 1 unless $Config::Config{useperlio};
} #skip
+my $t = <<'EOT_EOT';
+# 8 <@> leave[1 ref] vKP/REFC ->(end)
+# 1 <0> enter ->2
+# 2 <;> nextstate(main 1 -e:1) v:{ ->3
+# 7 <2> sassign vKS/2 ->8
+# 5 <@> index[t2] sK/2 ->6
+# - <0> ex-pushmark s ->3
+# 3 <$> const[PV "foo"] s ->4
+# 4 <$> const[GV "foo"] s ->5
+# - <1> ex-rv2sv sKRM*/1 ->7
+# 6 <#> gvsv[*_] s ->7
+EOT_EOT
+my $nt = <<'EONT_EONT';
+# 8 <@> leave[1 ref] vKP/REFC ->(end)
+# 1 <0> enter ->2
+# 2 <;> nextstate(main 1 -e:1) v:{ ->3
+# 7 <2> sassign vKS/2 ->8
+# 5 <@> index[t1] sK/2 ->6
+# - <0> ex-pushmark s ->3
+# 3 <$> const(PV "foo") s ->4
+# 4 <$> const(GV "foo") s ->5
+# - <1> ex-rv2sv sKRM*/1 ->7
+# 6 <$> gvsv(*_) s ->7
+EONT_EONT
+
+if ($] < 5.009) {
+ $t =~ s/GV /BM /;
+ $nt =~ s/GV /BM /;
+}
+
+checkOptree ( name => 'index and PVBM',
+ prog => '$_ = index "foo", "foo"',
+ expect => $t, expect_nt => $nt);
+
__END__