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)


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

|>     Is your use of the word "legal" based upon C/C++ standards?  My
|>     understanding was that the semantics of expressions at the tree
|>     level were supposed to be independent of the front-ends, and that
|>     if an operation is undefined in some subset of front-ends then
|>     choosing a behaviour that's consistent across the others is a
|>     reasonable prerogative.
|> 
|> There is *no* language, as far as I know, for which MAX_INT + 1 is defined,
|> let alone equal to MIN_INT.  So GCC is entitled to assume that EXP + 1 > EXP,
|> for example.

Except if you are dealing with unsigned arithmetic, which has defined
wrap-around semantics.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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