Jason Merrill <ja...@redhat.com> writes: > So we're setting TREE_OVERFLOW inappropriately for conversion to > signed integer types (though the front ends unset it again in cast > context), and, more problematically, failing to set it for unsigned > arithmetic overflow:
C99 6.2.5 paragraph 9 says "A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type." In the C++0x draft I have, 3.9.1 paragraph 4 says "Unsigned integers, declared unsigned, shall obey the laws of arithmetic modulo 2**N where n is number of bits in the value representation of that particular size of integer." So I don't think unsigned arithmetic can overflow in C/C++. Not sure about your point about TREE_OVERFLOW. Ian