In scalar (well, non-list) context, pp_list always yields exactly one stack
element. It must therefore extend the stack for that element, in case there
were no arguments on the stack when it started.
if (GIMME_V != G_ARRAY) {
SV **mark = PL_stack_base + markidx;
dSP;
+ EXTEND(SP, 1); /* in case no arguments, as in @empty */
if (++MARK <= SP)
*MARK = *SP; /* unwanted list, return last item */
else
set_up_inc(qw(. ../lib));
}
-plan( tests => 70 );
+plan( tests => 71 );
@foo = (1, 2, 3, 4);
cmp_ok($foo[0], '==', 1, 'first elem');
# this was passing a trash SV at the top of the stack to SvIV()
ok(($0[()[()]],1), "[perl #126193] list slice with zero indexes");
+
+# RT #131732: pp_list must extend stack when empty-array arg and not in list
+# context
+{
+ my @x;
+ @x;
+ pass('no panic'); # panics only under DEBUGGING
+}