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
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

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

gcc a.c


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: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: murtadha at ca dot ibm dot com


Reply via email to