First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 7642
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: anonymous@gcc.gnu.org
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Test1.i Test1.i text/x-c 2003-05-21 15:17 9.16 KB Edit
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 7642 depends on: Show dependency tree
Show dependency graph
Bug 7642 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-08-19 23:06
The following program illustrates an optimization problem with signbit() of a
long double NAN:

  #include <math.h>
  #include <stdio.h>
  #include <stdlib.h>
  int main(int argc, char* argv[])
  {
    long double n = NAN;
    if (signbit(n))
    {
      fprintf(stdout, "n is negative\n");
    }
    else
    {
      fprintf(stdout, "n is positive\n");
   }
    exit(0);
  }

When compiled with

  gcc -D_XOPEN_SOURCE=600 -o Test1 Test1.c

the resulting Test1 correctly prints "n is positive".  When compiled with

  gcc -D_XOPEN_SOURCE=600 -O -o Test1 Test1.c

or

  gcc -D_XOPEN_SOURCE=600 -O2 -o Test1 Test1.c

the resulting Test1 incorrectly prints "n is negative".  I am using gcc 3.2
on SuSE Linux/x86 7.1 (Linux kernel 2.4.0 and glibc 2.2).

Release:
gcc 3.2

Environment:
gcc 3.2 on SuSE Linux/x86 7.1 (kernel 2.4.0 and glibc 2.2)

------- Comment #1 From Eric Botcazou 2003-02-19 08:50 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed on 3.2 branch. 3.3 and mainline are not affected.

------- Comment #2 From Joe Buck 2003-04-25 21:18 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.

First Last Prev Next    No search results available      Search page      Enter new bug