summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--pp_hot.c4
-rw-r--r--t/lib/croak/pp_hot13
3 files changed, 16 insertions, 2 deletions
diff --git a/MANIFEST b/MANIFEST
index 7a5d0c072c..1396660928 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5034,6 +5034,7 @@ t/lib/compmod.pl Helper for 1_compile.t
t/lib/croak/mg Test croak calls from mg.c
t/lib/croak/op Test croak calls from op.c
t/lib/croak/pp_ctl Test croak calls from pp_ctl.c
+t/lib/croak/pp_hot Test croak calls from pp_hot.c
t/lib/croak.t Test calls to Perl_croak() in the C source.
t/lib/croak/toke Test croak calls from toke.c
t/lib/cygwin.t Builtin cygwin function tests
diff --git a/pp_hot.c b/pp_hot.c
index 77b707cc13..38c49a068a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2648,15 +2648,15 @@ try_autoload:
{
cv = GvCV(autogv);
}
- /* sorry */
else {
+ sorry:
sub_name = sv_newmortal();
gv_efullname3(sub_name, gv, NULL);
DIE(aTHX_ "Undefined subroutine &%"SVf" called", SVfARG(sub_name));
}
}
if (!cv)
- DIE(aTHX_ "Not a CODE reference");
+ goto sorry;
goto retry;
}
diff --git a/t/lib/croak/pp_hot b/t/lib/croak/pp_hot
new file mode 100644
index 0000000000..1e12fbbc55
--- /dev/null
+++ b/t/lib/croak/pp_hot
@@ -0,0 +1,13 @@
+__END__
+# NAME calling undef sub belonging to undef GV
+ my $foosub = \&foo;
+ undef *foo;
+ &$foosub;
+EXPECT
+Undefined subroutine &main::foo called at - line 3.
+########
+# NAME calling undef sub resident in its GV
+ my $foosub = \&foo;
+ &$foosub;
+EXPECT
+Undefined subroutine &main::foo called at - line 2.