[5986] in Athena Bugs
Saber msg: v2.1 (4/24/89 M1-139-1 vax Unix 4042 0)
daemon@ATHENA.MIT.EDU (roryoc@ATHENA.MIT.EDU)
Sat Sep 8 23:45:25 1990
From: roryoc@ATHENA.MIT.EDU
Date: Sat, 8 Sep 90 23:45:15 -0400
To: bugs@ATHENA.MIT.EDU
To whom it may concern,
Whilst running a routine to test type conversion we came across
an anomoly in the conversion of "long unsigned ints" to "doubles".
The routine we used is stated below:
#include <stdio.h>
main()
{
unsigned long int e ;
unsigned long int d ;
double f ;
e = 2147483647 ;
d = (unsigned long int) e + 1 ;
printf("%u\n", e) ;
printf("%u\n", d) ;
f = (double) e;
e = e * 2 ;
printf("f = %.0lf\n", f) ;
printf("%u %.0lf\n", e, e + 2.0) ;
}
The saber "ansi" flag was set to true and comparison runs were made with both
our standard "cc" and "gcc" compilers for comparison.
The results yielded from Saber became corrupted for values of e greater than
"e = 2147483646;". This value being two less than the maximum signed long int.
Attempting to place "e = 2147483647" into the double variable "f" caused some
form of automatic type conversion error.
This can be seen more simply by creating a double variable d in the workspace
and then assigning it values slightly above or below 2147483646.
eg: 12 -> double f;
13 -> f = 2147483646 ;
(double) 2.147484e+09
14 -> f = 2147483649 ;
(double) -2.147484e+09
####
We presume that Saber should accept type conversions of this nature and felt
it was relevant to notify you. I hope what I have described is adequate for
you to repeat the bug.
Yours sincerely,
Ruaidhri O' Connor, Patrick Kinnicutt. (roryoc@athena.mit.edu,
chess@athena.mit.edu)