[Bug tree-optimization/31248] Too much casting for char operands on tree level
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Mar 18 05:30:00 GMT 2007
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-03-18 05:29 -------
You are wrong. The casts are correct as char + char in C is actually defined
as (int)(char) + (int) (char) aka promoted to int while doing the addition so
what the optimizers do when it sees (char)((int)(char) + (int)(char)), it
changes the addition to be (unsigned char)(char) + (unsigned char)(char) so the
addition's overflow is defined as being wrapping instead of being undefined.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31248
More information about the Gcc-bugs
mailing list