Bug in loop optimize (invalid postinc to preinc transformation)
Torbjorn Granlund
tege@swox.com
Wed Dec 27 21:09:00 GMT 2000
Alexandre Oliva <aoliva@redhat.com> writes:
On Dec 27, 2000, Peter Osterlund <peter.osterlund@mailbox.swipnet.se> wrote:
> Compiling without optimization indicates that the compiler is
> transforming (p++ < x) into (++p < (x+1)), even when not optimizing.
> This transformation is incorrect because x+1 wraps around.
Overflow invokes undefined behavior. Since incrementing p in this
case involves overflow, I think the transformation is ok, as far as
undefined behavior goes.
Overflow of *unsigned* types is well-defined.
--
Torbjörn
More information about the Gcc
mailing list