Red Hat Bugzilla – Bug 131082
ia64 double conversion bug
Last modified: 2007-11-30 17:10:48 EST
gcc-3.4.1-9, ia64, dist-fc3 buildroot.
bash-3.00# cat dbl.c
int main(int argc, char **argv)
double d = -12.345;
long l = (d > LONG_MAX) ? (unsigned long) d : (long) d;
bash-3.00# gcc -Wall dbl.c
bash-3.00# gcc -O2 -Wall dbl.c
Yes the program is weird and stupid, but it seems to have well-defined
behaviour by C99, AFAICT.
if the line is changed to, e.g.:
long l = (d > LONG_MAX) ? (unsigned long) (puts(""), d) : (long) d;
it prints -12, also.
Forgot to mention: the program prints -12 on all our other platforms,