PL_stack_sp = PL_stack_base;
PL_op = PL_sortcop;
CALLRUNOPS(aTHX);
- if (PL_stack_sp != PL_stack_base + 1)
- Perl_croak(aTHX_ "Sort subroutine didn't return single value");
PL_op = sortop;
PL_curcop = cop;
pad = PL_curpad; PL_curpad = 0;
- result = SvIV(*PL_stack_sp);
+ if (PL_stack_sp != PL_stack_base + 1) {
+ assert(PL_stack_sp == PL_stack_base);
+ result = SvIV(&PL_sv_undef);
+ }
+ else result = SvIV(*PL_stack_sp);
PL_curpad = pad;
while (PL_scopestack_ix > oldscopeix) {
LEAVE;
PL_stack_sp = PL_stack_base;
PL_op = PL_sortcop;
CALLRUNOPS(aTHX);
- if (PL_stack_sp != PL_stack_base + 1)
- Perl_croak(aTHX_ "Sort subroutine didn't return single value");
PL_op = sortop;
PL_curcop = cop;
pad = PL_curpad; PL_curpad = 0;
- result = SvIV(*PL_stack_sp);
+ if (PL_stack_sp != PL_stack_base + 1) {
+ assert(PL_stack_sp == PL_stack_base);
+ result = SvIV(&PL_sv_undef);
+ }
+ else result = SvIV(*PL_stack_sp);
PL_curpad = pad;
while (PL_scopestack_ix > oldscopeix) {
LEAVE;
no warnings;
sub pyfg { undef }
sub pyfgc($$) { undef }
+use warnings;
+sub dog {}
+sub dogwood($$) {}
+@sort = sort dog 1,2;
+@sort = sort dogwood 1,2;
EXPECT
Use of uninitialized value $m1 in sort at - line 6.
Use of uninitialized value $g1 in sort at - line 6.
Use of uninitialized value in sort at - line 12.
Use of uninitialized value in sort at - line 13.
Use of uninitialized value in sort at - line 14.
+Use of uninitialized value in sort at - line 21.
+Use of uninitialized value in sort at - line 22.
########
my $nan = sin 9**9**9;
if ($nan == $nan) {