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] Constant fold -A - B as -B - A (take 2)


On 10-Feb-2003, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
>     > There is *no* language, as far as I know, for which MAX_INT + 1 is
>     > defined, let alone equal to MIN_INT.
> 
>     What about Java, C#, and Visual Basic?
> 
> I stand corrected.
> 
> This indicates that we really ought to add a bit to types to indicate
> whether or not overflow is defined.  Right now that's the unsigned
> bit, but, from what you say, that's clearly wrong.

IMHO it would be more natural to add the bit to operations
(e.g. to PLUS_EXPR tree nodes) rather than to types.

Actually there are more than two possibilities:
	1. overflow wraps
	2. overflow leads to undefined behaviour
	3. overflow is detected, and leads to a
	   trap/exception/signal/whatever.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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