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


    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.


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