|
Message-ID: <2dea9525-6a71-846b-87a6-9c743a76d3b2@gmail.com> Date: Thu, 13 Apr 2023 00:29:48 +0200 From: Gabriel Ravier <gabravier@...il.com> To: musl@...ts.openwall.com, Detlef Riekenberg <wine.dev@....de> Subject: Re: printf does not print anything (musl 1.2.3) On 4/12/23 23:35, Detlef Riekenberg wrote: > The attached test fails with musl 1.2.3 (does not print anything): > > > os: xubuntu 23.04 > compiled with: musl-gcc -O0 -std=c99 -Wall prog.c -o prog_musl-O0 > gcc: 12.2.0-17ubuntu1 > > > The programm is a tic-tac-toe game, but the source is stange: > * Filesize Original: 2745 byte (includes only <stdio.h>) > * Filesize after preprocess: with musl ~559k / with gnu libc ~571k > * After preprocess, the format string is ~100kb > * main() uses only one printf, and one arg has a scanf: > > ` > int main() { > while(*d) printf(fmt, arg); > } > ` > > For testing, i removed the "while(*d)", > but the binary using musl still does not print anything. > > > Compiling the original source with the same gcc and using gnu libc works > and the gnu libc version with the removed "while (*d)" produces an output of 23592 byte. > > > ioccc page: https://www.ioccc.org/2020/carlini/index.html > Also available on github: https://github.com/carlini/printf-tac-toe > > > I tried to subscribe to the list, but i have no confirmation yet, so please cc me. > > > -- > Bye bye ... Detlef The printf call in the linked program attempts to use printf with numbered argument conversion specifications with a position larger than 9 (such as 42). This is not portable to all POSIX systems, as POSIX specifies that the implementation need only support numbered argument conversion specifications with a position that is at most as large as the NL_ARGMAX macro (defined in limits.h), and POSIX's minimum requirement on the value of NL_ARGMAX is only of 9. Thusly, musl defines NL_ARGMAX to 9 and errors on numbered argument conversion specifications with a position larger than it.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.