[6008] in Athena Bugs
Saber msg: v2.1 (4/24/89 m1-238-4 vax Unix 4042 0)
daemon@ATHENA.MIT.EDU (lerman@ATHENA.MIT.EDU)
Tue Sep 11 15:45:55 1990
From: lerman@ATHENA.MIT.EDU
Date: Tue, 11 Sep 90 15:45:39 -0400
To: bugs@ATHENA.MIT.EDU
Cc: lerman@ATHENA.MIT.EDU
There appears to be a bug in how Saber-C handles conversions from
unsigned long int to double. When the following program is run
using the gcc compiler:
#include <stdio.h>
main ()
{
unsigned long int uval;
double dval;
uval = 3000000000U;
dval = uval;
printf("Values are %u and %e\n", uval, dval);
}
It produced the following output:
Values are 3000000000 and 3.000000e+09
It was compiled on a Project Athena VAXStation 3100 running the
standard Athena release. When this same program was loaded into Saber-C
and run, it produced the following:
Values are 3000000000 and -1.294967e+09
Program exiting with return status = 0.
This problem can be verified by typing C statements to Saber-C
directly and asking it to do the following:
unsigned long int uval;
uval = 3000000000;
(double) uval;
It appears as though the cast is treating uval as a signed value.
Please let me know if you receive this report.
Steven R. Lerman
Professor of Civil Engineering