[PATCH] Improved re-association of signed arithmetic

Robert Dewar dewar@adacore.com
Fri May 18 21:14:00 GMT 2012


On 5/18/2012 4:27 PM, Ulrich Weigand wrote:

> I finally got some time to look into this in detail.  The various special-
> case transforms in associate_plusminus all transform a plus/minus expression
> tree into either a single operand, a negated operand, or a single plus or
> minus of two operands.  This is valid as long as we can prove that the
> newly introduced expression can never overflow (if we're doing signed
> arithmetic).

It's interesting to note that for Ada, reassociatin is allowed if there
are no overriiding parens, even if it would introduce an overflow 
(exception) that would not occur otherwise. However, I think I prefer
the C semantics!



More information about the Gcc-patches mailing list