This is the mail archive of the gcc@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


On Thu, Feb 13, 2003 at 02:10:10PM -0500, Robert Dewar wrote:
> > But undefined overflow is a superset of two's complement semantics
> 
> I don't understand the terminology here. Are you using "two's comlement" to
> imply unsigned wrap around, i.e. throw away carry and ignore overflow. If so,
> that's a bit confusing, since it presupposes the conclusion. The issue with
> twos complement signed arithmetic is preciesely what happens on overflow (that's
> the only thing that distinguishes it from unsigned).

To clarify: if we have code that might overflow, we can generate a
variety of different forms of assembler language, as long as the
cases that don't overflow compute the correct results.  One of the
possibilities is to generate a two's complement addition.  Another
is to generate a trapping addition.

If we use two's complement addition, which is associative, we can make
further transformations.


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