[Bug tree-optimization/85284] [7/8 Regression] Loop miscompilation starting with r238367

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 9 09:57:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85284

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
What triggers this somehow (still didn't get to the "wrong" parts) is that we
compute zero iterations for the conditional iteration of if _2 > 2.  That's
of course wrong.  We do that via derive_simple_iv_with_niters computing
{7, +, 7} with *niters == 0 which then is "merged" with the niters computed
by niter analysis of _that_ "simplified" IV computing _also_ zero.  Which
then results in an always true assumption.

So while I can't pin-point the exact wrongness it looks to me that we
cannot really take the number_of_iterations_cond niter result for
granted as it was computed under an assumption we are going to compute
with its result -- kind-of a catch 22.

So it's tempting to special-case zero for *niter of simple_iv_with_niters
but I'm not sure the same issue wouldn't reproduce with random other
*niter?

Bin?


More information about the Gcc-bugs mailing list