gsf@astroatc.UUCP (Greg Fischer) (01/19/89)
Running the latest Plum-Hall C Validation Suite through 4.3BSD C on a VAX 11/780, it appears that when the compiler converts an unsigned to a double during constant-folding, the _unsigned_ value is treated as the _signed_ value with the equivalent bit-pattern. For example, code generated for double d = 0xfffffffd; will put -3.0 into d, rather than the expected unsigned value. Code generated for unsigned u = 0xfffffffd; double d = u; is correct. On investigating the compiler code (trees.c), at the point that the conversion is done, they actually test if the integer value is unsigned, but commented out the code to cast the value to unsigned before doing the conversion to double. Why did they comment out the cast to unsigned?