This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with unsigned long long on ultrasparc


Here's a simple program:

#include <stdlib.h>
#include <stdio.h>

int main() {
  unsigned long long a[10];
	
#define BASE_DIV_2 (((unsigned long long) 1) << 63)

 a[0] = -1;
 printf("%ull\n", a[0]);
 printf("%ull\n", BASE_DIV_2);
 if (a[0] < BASE_DIV_2)
   printf("Problem\n");
 else
   printf("OK\n");
}

With this version of gcc:

peano-30% gcc -v
Reading specs from /opt/egcs-19980816/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.54/specs
gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)

I get:

peano-31% gcc -O1 -o testlong testlong.c
peano-32% testlong
4294967295ll
2147483648ll
OK

but

peano-27% gcc -O1 -mcpu=ultrasparc -o testlong testlong.c
peano-28% testlong
4294967295ll
2147483648ll
Problem

This is on Solaris 2.5.1.

Brad Lucier    lucier@math.purdue.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]