* sort block, which is a CXt_NULL
* not a CXt_SUB */
dounwind(0);
+ PL_stack_base[1] = *PL_stack_sp;
+ PL_stack_sp = PL_stack_base + 1;
return 0;
}
else
if (cxix < cxstack_ix)
dounwind(cxix);
- if (CxMULTICALL(&cxstack[cxix]))
+ if (CxMULTICALL(&cxstack[cxix])) {
+ gimme = cxstack[cxix].blk_gimme;
+ if (gimme == G_VOID)
+ PL_stack_sp = PL_stack_base;
+ else if (gimme == G_SCALAR) {
+ PL_stack_base[1] = *PL_stack_sp;
+ PL_stack_sp = PL_stack_base + 1;
+ }
return 0;
+ }
POPBLOCK(cx,newpm);
switch (CxTYPE(cx)) {
@INC = '../lib';
}
use warnings;
-print "1..141\n";
+print "1..143\n";
# these shouldn't hang
{
# Using return() should be okay even in a deeper context
@b = sort {while (1) {return ($a <=> $b)} } 1..10;
ok("@b", "1 2 3 4 5 6 7 8 9 10", "return within loop");
+
+# Using return() should be okay even if there are other items
+# on the stack at the time.
+@b = sort {$_ = ($a<=>$b) + do{return $b<=> $a}} 1..10;
+ok("@b", "10 9 8 7 6 5 4 3 2 1", "return with SVs on stack");
+
+# As above, but with a sort sub rather than a sort block.
+sub ret_with_stacked { $_ = ($a<=>$b) + do {return $b <=> $a} }
+@b = sort ret_with_stacked 1..10;
+ok("@b", "10 9 8 7 6 5 4 3 2 1", "return with SVs on stack");