http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58143

--- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Summary:

tree-ssa-loop-im.c moves code, out of an if statement inside the loop
it it can not cause side effects or faults, but it does not care of integer
overflows. this seems to be an optimization!

BUT tree-ssa-loop-niter.c (infer_loop_bounds_from_signedness)
does assume that the code will never execute integer additions or subtractions
with the intention to use the result as modulo 2^32, thus ignoring overflow.

It seems that -O3 and -fno-strict-overflow will fix the code.

however this comment in tree.h points to another problem:

   IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
   must issue a warning based on warn_strict_overflow.  In some cases
   it will be appropriate to issue the warning immediately, and in
   other cases it will be appropriate to simply set a flag and let the
   caller decide whether a warning is appropriate or not.

this example does not generate any warnings, not with -Wall and not
with -Wstrict-overflow...

Reply via email to