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

John Scott via crossgcc <[email protected]> Sat, 29 Oct 2022 21:37:05 +0000
Newsgroups gmane.comp.gcc.cross-compiling
Message-ID <[email protected]>
--===============3416822635840101913==
Content-Type: multipart/signed; micalg="pgp-sha256";
	protocol="application/pgp-signature"; boundary="=-zjT0NcnM4Ea67VOi6ZD9"


--=-zjT0NcnM4Ea67VOi6ZD9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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/late=
st/debian/rules

I ran into this hang running the Newlib test suite.


--=-zjT0NcnM4Ea67VOi6ZD9
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----

iIgEABYIADAWIQSiPzylvTnZ6xisfzWz9N0oYfTNugUCY12dAhIcanNjb3R0QHBv
c3Rlby5uZXQACgkQs/TdKGH0zbrODQEAtfxB0/W22Q8o6b3e6GT34k8/Lg8ZrKl7
msgfvANdJjABAM+0Lq6vieSNoLSdbuyrHZQweur55jfR6Eb2+mC5zlEE
=KYLF
-----END PGP SIGNATURE-----

--=-zjT0NcnM4Ea67VOi6ZD9--

--===============3416822635840101913==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
For unsubscribe information see http://sourceware.org/lists.html#faq

--===============3416822635840101913==--