[Bug tree-optimization/34114] Missed optimization: cannot determine loop termination

rakdver at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 16 02:38:00 GMT 2007

------- Comment #6 from rakdver at gcc dot gnu dot org  2007-11-16 02:38 -------
(In reply to comment #2)
> Is there be any way to modify the code such that GCC would have an easier time
> seeing this? I tried using 'assert(rnd_to_2 % 2 == 0)' (since glibc's
> __assert_fail is marked with noreturn I thought it might help), but that didn't
> seem to have an effect.

As a workaround, you may change the type of i and rnd_to_2 to signed (signed
arithmetics in C is guaranteed not to overflow, and loop optimizer will use
this to prove that the loop is finite).



More information about the Gcc-bugs mailing list