This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
64-bit problem with Sun Ultra-5
- To: gcc bug <egcs-bugs at egcs dot cygnus dot com>
- Subject: 64-bit problem with Sun Ultra-5
- From: Paul Kinzelman <pkinz at timesync dot com>
- Date: Thu, 20 May 1999 15:24:25 -0700
I'm running gcc version 2.8.1on:
Sun: Ultra 5 running Solaris 7 (uname says SunOS 5.7)
RedHat6: Pentium-2, 233MHz running Linux 2.2.5-15
If I do the following:
unsigned long x, y;
unsigned long long z;
x = 123;
y = 456;
z = (((unsigned long long)y) * 1000000000) + x;
printf ("y,x=%ld,%ld; z=%Ld\n", y, x, z);
The printf shows:
Sun: y,x=456,123; z=106 [bogus]
RH6: y,x=456,123; z=456000000123 [correct]
I tried these alternatives with the same result:
z = (y * 100000000ULL) + x;
z = (y * ((unsigned long long)100000000)) + x;
I got down this path because I was getting bogus answers
elsewhere in the program I was writing, so
I think the problem is more than just how they print.
Any help would be greatly appreciated!
--
-Paul Kinzelman, San Jose, CA, ISD Corp