[PATCH] Document arithmetic overflow semantics

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Thu Feb 13 17:54:00 GMT 2003


    I doubt it; the reason is that the particular assumption that addition
    and multiplication follow the natural two's complement rules gives us
    an algebraic ring, which makes many transformations possible.  Any other
    assumption would introduce an irregularity that has to be tested for in
    each transformation.

I'm thinking of (A * 2) / 2.  This is A only if you are allowed to
assume that an overflow of the multiplication is undefined.

There are numerous cases in loop optimizations too.



More information about the Gcc mailing list