basic VRP min/max range overflow question

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Fri Jun 17 12:09:00 GMT 2005


>       [#1] The signed C integer types int,  long,  long  long  and  the
>       corresponding  unsigned  types  are compatible with LIA-1.  If an
>       implementation adds support  for  the  LIA-1  exceptional  values
>       integer_overflow  and  undefined,  then  those  types  are  LIA-1
>       conformant types.
>  
>
They need not wrap around.  People that are actually on the C standards 
committee have told you this multiple times.

>       C's unsigned integer types are "modulo" in the
>       LIA-1  sense  in that overflows or out-of-bounds results silently
>       wrap. An implementation that defines signed integer types as also
>       being  modulo  need  not  detect integer overflow, in which case,
>       only integer divide-by-zero need be detected.
>  
>
This is different from signed types.  Actually I was wrong,

   [10U, UINT_MAX] + [ 1U, 1U ] == ~[ UINT_MIN + 1, 10U ]

Paolo



More information about the Gcc mailing list