Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 11655
Product:  
Component:  
Status: RESOLVED
Resolution: DUPLICATE of bug 323
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: nick@ilm.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

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

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2003-07-24 02:24
This is a cut down version of some fp classification code.  The odd
thing is that it gets the correct answer with -O1 or with -mcpu=pentium4
-mfpmath=sse, but is incorrect at -O0.  Using 3.2.3 -O0 and -O1 both work.

the following code should print out 4094:

----
extern int printf(const char *,...);

typedef union { double d; unsigned long long ull; } doublebits;

inline int func(double x) {
    doublebits bits;
    bits.d = x;
    printf("%llu\n", bits.ull >> 51);
    return 0;
}

int main(int argc, const char **argv) {
  doublebits snan;
  snan.ull = 0x7ff0000000000001ULL;
  func(snan.d);
  return 0;
}
----

> /dept/rnd/vendor/gcc-3.3.1-20030720/bin/gcc -O0 longlong.c -o longlong
> ./longlong
4095
> /dept/rnd/vendor/gcc-3.3.1-20030720/bin/gcc -O1 longlong.c -o longlong
> ./longlong
4094
> /dept/rnd/vendor/gcc-3.3.1-20030720/bin/gcc -O0 -march=pentium4 -mfpmath=sse
longlong.c -o longlong
> ./longlong 
4094
> /dept/rnd/vendor/gcc-3.2.3/bin/gcc -O0 longlong.c -o longlong
> ./longlong
4094

------- Comment #1 From Andrew Pinski 2003-07-24 02:40 -------
This is caused by loading and then storing by the floating point registers, so
this is not a bug;  It is 
the excessive precession on x86 with gcc so this is a dup of bug 323.

*** This bug has been marked as a duplicate of 323 ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug