This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/11585] New: signbit() macro on IA64 fails on long double -NaN
- From: "pasky at suse dot cz" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 May 2010 00:44:26 -0000
- Subject: [Bug math/11585] New: signbit() macro on IA64 fails on long double -NaN
- Reply-to: sourceware-bugzilla at sourceware dot org
signbit() on a -NaN will not correctly detect the sign if the assembly version
is used. Small testcase:
#include <math.h>
int main()
{
float f = -0.0/0.0;
printf ("%d vs. %d\n", __signbitf(f), __builtin_signbit(f));
return 0;
}
Prints: 0 vs. 1
If you force the use of mathinlines.h by compiling with -O2 -std=c99, the
result will be correct, but with just -O2 or -O0 without -std=c99
the mathinlines won't be used, and hence the incorrect implementation in
libc.so is called.
Unfortunately, fclass.m fclass9 as used in the assembly
.mfi
fclass.m p6, p7 = farg0, @zero | @unorm | @norm | @inf | @neg
;;
seemingly cannot be used for NaN sign testing according to Intel specs - of
course the concept of NaN sign is kind of strange, but IEEE mandates it.
Perhaps it would be best to disable the assembly version altogether?
(The description includes comments by Richard Guenther and Michael Matz from a
private Novell bug.)
--
Summary: signbit() macro on IA64 fails on long double -NaN
Product: glibc
Version: 2.12
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj at suse dot de
ReportedBy: pasky at suse dot cz
CC: glibc-bugs at sources dot redhat dot com,hjl dot tools
at gmail dot com
GCC host triplet: ia64-suse-linux-gnu
GCC target triplet: ia64-suse-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=11585
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.