The stash of the GV is what's being used to look up a global variables name. If
the GV has no stash, we might as well give up early. This fixes a segfault
because S_varname would later assume gv_fullname4 has resolved the glob's full
name and try to use the svu_pv slot of the scalar returned, while all it got
back was undef.
case OP_GVSV:
gv = cGVOPx_gv(obase);
- if (!gv || (match && GvSV(gv) != uninit_sv))
+ if (!gv || (match && GvSV(gv) != uninit_sv) || !GvSTASH(gv))
break;
return varname(gv, '$', 0, NULL, 0, FUV_SUBSCRIPT_NONE);
__END__
EXPECT
Use of uninitialized value in addition (+) at - line 3.
+########
+use warnings 'uninitialized';
+delete $::{'Foo::'};
+my $moo = $Foo::BAR + 42;
+__END__
+EXPECT
+Use of uninitialized value in addition (+) at - line 3.