[Bug middle-end/35163] [4.1/4.2/4.3 Regression] folding comparison loses cast

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Feb 12 20:00:00 GMT 2008



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-02-12 19:59 -------
get_unwidened behaves as documented:

   If FOR_TYPE is nonzero, we return a value which, if converted to
   type FOR_TYPE, would be equivalent to converting OP to type FOR_TYPE.

thus indeed, (signed char)(int)(unsigned short)-41sc == -41sc.  But the
bug instead is that fold specifies FOR_TYPE, where it rather should
not specify it and convert the result to shorter_type if and only if this
conversion is not a truncation.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35163



More information about the Gcc-bugs mailing list