This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11655] New: [3.3 regression] long long/double -O0 produces incorrect code
- From: "nick at ilm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jul 2003 02:24:53 -0000
- Subject: [Bug optimization/11655] New: [3.3 regression] long long/double -O0 produces incorrect code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11655
Summary: [3.3 regression] long long/double -O0 produces incorrect
code
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nick at ilm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
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