new gcc bug
Paul Zimmermann
Paul.Zimmermann@loria.fr
Tue Jun 24 08:15:00 GMT 2003
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Date: 23 Jun 2003 18:09:23 +0200
Paul.Zimmermann@loria.fr (Paul Zimmermann) writes:
int main() {
unsigned long c = 70423129, q;
q = (~((unsigned long) 0)) / c;
printf ("q=%lu\n", q);
}
> gcc version 3.2 20020329 (experimental)
> Given output:
> bash-2.04$ ./a.out
> q=4243519447
>
> Expected output:
> bash-2.04$ cc bug.c; ./a.out
> q=60
I cannot reproduce this on ia64-linux with gcc 3.2.3 (or any other
release). Note that the correct result is 261941557207, not 60, since
long has 64 bit on ia64.
But under ia64-hpux, long has only 32 bits:
printf ("sizeof(unsigned long)=%u\n", sizeof(unsigned long));
printf ("sizeof(unsigned long long)=%u\n", sizeof(unsigned long long));
sizeof(unsigned long)=4
sizeof(unsigned long long)=8
Please try to reproduce this bug with our current release (3.3). If it
is still there, please enter it into our database at
http://gcc.gnu.org/bugzilla/.
Unfortunately I cannot find gcc-3.3 on spe175.testdrive.hp.com.
Paul
More information about the Gcc-bugs
mailing list