public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/11585] New: signbit() macro on IA64 fails on long double -NaN
@ 2010-05-11  0:44 pasky at suse dot cz
  0 siblings, 0 replies; only message in thread
From: pasky at suse dot cz @ 2010-05-11  0:44 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-11  0:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-11  0:44 [Bug math/11585] New: signbit() macro on IA64 fails on long double -NaN pasky at suse dot cz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).