[comp.sys.mips] Type conversion error in cc

poe@kos.rci.dk (Poul Oestergaard) (10/11/90)

The following program:

main()
{
	unsigned long l1, l2;
	double d;

	l1 = 4000000000L;
	d  = l1;
	l2 = d;

	printf("l1 = %lu\nd  = %14.0f\nl2 = %lu\n", l1, d, l2);
}

produces:

l1 = 4000000000
d =     4000000000
l2 = 2147483647

when compiled with MIPS cc and executed. l2 should be equal to l1 and d.
The error is in version 1.31, 2.0, and 2.10 of the MIPS cc compiler.

Does anyone have a MIPS compiler source level fix to this problem,
since it is causing us some problems?

The error has been accepted by MIPS, but not corrected yet.

Regards
Poul Oestergaard
RC International
Denmark

Mail: poe@rci.dk