https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45464
--- Comment #3 from Andrew Pinski ---
Actually I think only the warning for the three add case is wrong and here is
why:
adding two (unsigned) 8bit integers together will only give you a max a 9bit
integer.
so comparing b and (a+a) is fine
Addin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45464
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed|
--- Comment #1 from brutus at free dot fr 2010-08-31 13:53 ---
There is a small mystake to the snippet, it should read instead:
int main()
{
unsigned char a = 0;
unsigned int b = 0;
bool test1 =( b < a + a);
bool test2 =( b < a + a + a);
if (test1 && test2) return 1;
}
--