This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12000] New: GCC library allows the use of a negative value for 'NAN'


Looking at the source code below, ompiling and linking without any extra
options, one would expect the output of execution to be:
c = nan

And that is correct for GCC on RHEL5 and SLES10, with version 4.1.2. However,
on RHEL6 and SLES11, starting with GCC version 4.3.4, the output is the
following:
c = -nan

Which doesn't make much sense, since you can't really have a negative NAN.
At the same time, when the code is compiled on RHEL5, and ran on RHEL6, the
output still shows a negative NAN. It turns out that only compiling and linking
statically (with -static) allows the results of RHEL5 to be achieved on RHEL6,
and vice versa. This tells us that the libraries are responsible for this
change.

Please see bugzilla report# 45620 opened in the GCC bugzilla:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45620

CODE:
/* File name a.c */
int main()
{
        double a = 0.0;
        double c = -(a/a);
        printf("c = %f\n", c);
}

COMPILE:
gcc a.c

RUN:
./a.out

EXPECTED RESULTS: (identical to previous release of GCC)
c = nan

ACTUAL RESULTS: (starting with GCC 4.3.4)
c = -nan

-- 
           Summary: GCC library allows the use of a negative value for 'NAN'
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: murtadha at ca dot ibm dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=12000

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]