[Bug tree-optimization/58246] [4.7/4.8/4.9 Regression] wrong code at -O1 and above

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 29 10:58:00 GMT 2013


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
We decide to stop because we think that we reached a killing definition when
looking for possible defs of

  _8 = t[a.0_6];

and reach, over the loop backedge

  t[a.0_6] = 0;

here:

          /* Or they need to be exactly the same.  */
          else if (ref->ref
                   /* Make sure there is no induction variable involved
                      in the references (gcc.c-torture/execute/pr42142.c).
                      The simplest way is to check if the kill dominates
                      the use.  */
                   && dominated_by_p (CDI_DOMINATORS, (basic_block) data,
                                      gimple_bb (def_stmt))
                   && operand_equal_p (ref->ref, lhs, 0))
            return true;

where the dominance check was supposed to prevent this bug from happening...

I have a fix.



More information about the Gcc-bugs mailing list