>>>> tem = (char) 255 + (char) 1; >> >> tem is always of type 'char' in GIMPLE (even if later promoted >> via PROMOTE_MODE) the value-range is a 'char' value-range and thus >> never will exceed [CHAR_MIN, CHAR_MAX]. The only way you can >> use that directly is if you can rely on undefined behavior >> happening for signed overflow - but if you argue that way you >> can simply _always_ drop the (sext:SI (subreg:QI part and you >> do not need value ranges for this. For unsigned operations >> for example [250, 254] + [8, 10] will simply wrap to [3, 7] >> (if I got the math correct) which is inside your [CHAR_MIN + 1, >> CHAR_MAX - 1] but if performed in SImode you can get 259 and >> thus clearly you cannot drop the (zext:SI (subreg:QI parts. >> The same applies to signed types if you do not want to rely >> on signed overflow being undefined of course. >> > > Thanks for the explanation. I now get it and I will rework the patch. > I have attempted to implement what Richard suggested. If you think this is what you want, I will go ahead and implement the missing gimple binary statements. Thanks again. Kugan