[PATCH] Document arithmetic overflow semantics
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Fri Feb 14 14:24:00 GMT 2003
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.
More information about the Gcc-patches
mailing list