Date: Mon, 26 Jun 2023 19:09:38 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 272229] printf produces bogus output when printing double 0x00000000000000ff with %g Message-ID: <bug-272229-7@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272229 Bug ID: 272229 Summary: printf produces bogus output when printing double 0x00000000000000ff with %g Product: Base System Version: 13.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: arm Assignee: freebsd-arm@FreeBSD.org Reporter: fuz@FreeBSD.org CC: diizzy@FreeBSD.org Consider this test program: #include <stdio.h> int main() { union intfloat { int i; double f; } intf; intf.i =3D 255; printf("%g\n", intf.f); } This should print (e.g. on aarch64): $ cc -o bug bug.c $ ./bug 1.25987e-32 But on armv7 we get instead: $ ./bug e-309 Furthermore, there is an embedded NUL byte in the output: $ ./bug | od -c=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 0000000 \0 e - 3 0 9 \n=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 0000007 Preliminary debugging suggests that this could be because dtoa() returns an empty string when vfprintf attempts the conversion. Further debugging is hindered as gdb cannot find debug symbols for dtoa (it seems to expect a so= urce file of different name than the actual file). Among other things, this error causes devel/orc to fail during build. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272229-7>