This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/31248] Too much casting for char operands on tree level



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]