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


    However, once you allow an optimizer to back propagate the assumption
    that a program has a defined behavior, things may get surprising, and
    as you can see from my earlier message, there is a not too far fetched
    scenario in which a well meaning implementation could in fact end up
    deleting the system disk unintentionally as an indirect consequence of
    an uninitialized variable.

I guess the question is what exactly "back propagate" mean in practice. I
think most people agree that doing so *explicitly* is a bad idea and doesn't
produce any optimizations of correct programs in practice.

The issue is in something like my A * 2 / 2 example in C.  Technically
speaking, you can view optimizing this to A as doing that back-propagation,
but an alternate way to look at it is to redefine the arithmetic with
"undefined" as a value and allow the simplification to be valid if
certain well-defined behavior on that arithmetic is preserved.


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