>>>>> "Paolo" == Paolo Bonzini <[EMAIL PROTECTED]> writes:

>> On Wed, Dec 20, 2006 at 03:50:23PM +0000, Joseph S. Myers wrote:
>> For signed integers, overflow is undefined, but for unsigned integers,
>> overflow wraps.

Paolo> You mean writing the hypothetical PLUS_WRAP_EXPR <a, b> (where a and b
Paolo> are ints) as (int) ((unsigned)a + (unsigned)b)?

Paolo> That might work actually.  However, I don't know if the optimizers
Paolo> will be able to see through the casts and perform all the subsequent
Paolo> optimizations appropriately.

I think we already have some problems with this... as I recall PR 21855
includes a problem in this area (though it is somewhat glossed over in
the PR itself).

FWIW LLVM recently moved to having unsigned operations rather than
unsigned types.  Here's a bit of info on it:

    http://nondot.org/sabre/LLVMNotes/TypeSystemChanges.txt

Tom

Reply via email to