[PATCH] Document arithmetic overflow semantics

Andrew Haley aph@redhat.com
Thu Feb 13 18:44:00 GMT 2003


Roger Sayle writes:
 > 
 > 
 > Do you believe the Java front-end is currently incorrect to use
 > PLUS_EXPR to represent signed addition?

It probably is.  

Java requires strict 32-bit two's complement arithmetic for its ints,
and PLUS_EXPR isn't guaranteed to do that.  We could, of course,
generate something like

   uint((ulong)a + (ulong)b)

which would be well defined. 

Andrew.



More information about the Gcc mailing list