Help with a hang in snprintf() for sh-elf

John Scott jscott@posteo.net
Sat Oct 29 21:37:05 GMT 2022


Hi,

I'm the maintainer of gcc-sh-elf for Debian, and I'm curious why the
following program seems to hang with GCC 12, Newlib 3.3.0, and Binutils
2.37, running the program under the appropriate simulator from GDB:

$ cat test.c
#include <stdio.h>
int main(void) {
	snprintf(NULL, 0, "%lf", 1.0);
}

$ sh-elf-gcc test.c
$ sh-elf-run a.out
$ # hangs

Note that if the floating point number is changed to 0.0, the hang
doesn't happen anymore.

The recipe used to build this cross toolchain can be seen at
https://salsa.debian.org/electronics-team/toolchains/gcc-sh-elf/-/blob/latest/debian/rules

I ran into this hang running the Newlib test suite.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: This is a digitally signed message part
URL: <https://sourceware.org/pipermail/crossgcc/attachments/20221029/b2f1325e/attachment.sig>


More information about the crossgcc mailing list