Let fold_rtx's unsigned_fix be consistent with other cases
Alexandre Oliva
aoliva@redhat.com
Sat Nov 18 14:48:00 GMT 2000
The value of `(unsigned char)((unsigned char)3 - (float)5)' is usually
expected to be `(unsigned char)0-(unsigned char)2', even though
technically it invokes undefined behavior. However, it is quite
surprising that we get the expected result when the expression is
folded upfront, in the tree level. However, if the expression is
convoluted enough that it makes it to cse, when cse applies fold_rtx()
to it, it gets 0 instead.
Here's a patch that arranges for real.c to compute the expected value.
Ok to install? (Will bootstrap and test on i686-pc-linux-gnu, in
addition to the already-tested mn10300-elf, if I get encouraging
feedback)
More information about the Gcc-patches
mailing list