printf with an empty list was reading past the end of the stack and
using whatever it found as its format. If given an empty list, it
should treat the format as "".
= (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv;
IO *const io = GvIO(gv);
= (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv;
IO *const io = GvIO(gv);
+ /* Treat empty list as "" */
+ if (MARK == SP) XPUSHs(&PL_sv_no);
+
if (io) {
const MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
if (io) {
const MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
my $foo = 'STDOUT';
print $foo "ok 1\n";
my $foo = 'STDOUT';
print $foo "ok 1\n";
my $n = "abc";
printf "ok 22%n - not really a test; just printing\n", substr $n,1,1;
print "not " x ($n ne "a5c") . "ok 23 - printf with %n (got $n)\n";
my $n = "abc";
printf "ok 22%n - not really a test; just printing\n", substr $n,1,1;
print "not " x ($n ne "a5c") . "ok 23 - printf with %n (got $n)\n";
+
+# [perl #77094] printf with empty list
+() = ("not ");
+printf +();
+print "ok 24 - printf +() does not steal stack items\n";