This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/16965] New: tst-strtod-round fails on 32-bit sparc
- From: "aurelien at aurel32 dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 20 May 2014 13:28:17 +0000
- Subject: [Bug libc/16965] New: tst-strtod-round fails on 32-bit sparc
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16965
Bug ID: 16965
Summary: tst-strtod-round fails on 32-bit sparc
Product: glibc
Version: 2.20
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: aurelien at aurel32 dot net
Reporter: aurelien at aurel32 dot net
CC: drepper.fsp at gmail dot com
Host: sparc-linux-gnu
Target: sparc-linux-gnu
Build: sparc-linux-gnu
tst-strtod-round fails on 32-bit sparc with the following errors:
strtold (0x1p-16446) returned 0x0.000000000000000100000001p-16382 not
0x0.0000000000000001p-16382 (default rounding mode)
strtold (0x1p-16446) returned 0x0.000000000000000100000001p-16382 not
0x0.0000000000000001p-16382 (FE_DOWNWARD)
strtold (0x1p-16446) returned 0x0.000000000000000100000001p-16382 not
0x0.0000000000000001p-16382 (FE_TOWARDZERO)
strtold (0x1p-16446) returned 0x0.000000000000000100000001p-16382 not
0x0.0000000000000001p-16382 (FE_UPWARD)
strtold (-0x1p-16446) returned -0x0.000000000000000100000001p-16382 not
-0x0.0000000000000001p-16382 (default rounding mode)
strtold (-0x1p-16446) returned -0x0.000000000000000100000001p-16382 not
-0x0.0000000000000001p-16382 (FE_DOWNWARD)
strtold (-0x1p-16446) returned -0x0.000000000000000100000001p-16382 not
-0x0.0000000000000001p-16382 (FE_TOWARDZERO)
strtold (-0x1p-16446) returned -0x0.000000000000000100000001p-16382 not
-0x0.0000000000000001p-16382 (FE_UPWARD)
Digging into the code, the issue is that __mpn_rshift is called with cnt = 0,
while stdlib/rshift.c explicitly says that cnts should satisfy 0 < CNT <
BITS_PER_MP_LIMB. In this case, the code end up doing a logical shift right of
the same size than the register (32 bit there), which is undefined in the C
standard.
While the problem appears on sparc for this specific value, I believe that it
is possible to find values which do not work on architectures which only use
the lower part of the register to get the shift amount. This includes for
example mips or aarch64.
Patch will follow soon on the mailing list.
--
You are receiving this mail because:
You are on the CC list for the bug.