This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Document arithmetic overflow semantics


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]