| Summary: | [3.3 regression] long long/double -O0 produces incorrect code | ||
|---|---|---|---|
| Product: | gcc | Reporter: | nick |
| Component: | rtl-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | gcc-bugs |
| Priority: | P2 | ||
| Version: | 3.3.1 | ||
| Target Milestone: | 3.4.0 | ||
| Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
| Build: | i686-pc-linux-gnu | Known to work: | |
| Known to fail: | Last reconfirmed: | ||
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