[Bug middle-end/37731] New: unsigned long long may not work correctly on 32bit host
hjl dot tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 3 21:38:00 GMT 2008
On Linux/ia32, gcc 4.4 gave:
[hjl@gnu-31 longlong-2]$ cat y.c
#include <stdio.h>
extern void abort ();
unsigned long long xh = 1ull;
int
main ()
{
unsigned long long yh = 0xffffffffull;
unsigned long long z = xh * yh;
unsigned long long i = 1ull * yh;
printf ("%llx\n", i);
printf ("%llx\n", z);
if (z != i)
abort ();
}
[hjl@gnu-31 longlong-2]$ gcc -m32 -O y.c
[hjl@gnu-31 longlong-2]$ ./a.out
ffffffff
ffffffffffffffff
Aborted
[hjl@gnu-31 longlong-2]$
On Linux/Intel64, I got
[hjl@gnu-6 longlong-2]$ gcc -m32 -O y.c
[hjl@gnu-6 longlong-2]$ ./a.out
ffffffff
ffffffff
[hjl@gnu-6 longlong-2]$
On 32bit hosts, we didn't handle unsigned long long properly.
--
Summary: unsigned long long may not work correctly on 32bit host
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37731
More information about the Gcc-bugs
mailing list