https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62025
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, what about this completely untested fix? Unfortunately the scheduler change has been committed with no testcases. I guess I'll do a bootstrap/regtest with some printout where this patch changes things and where we consider it at all. --- gcc/sched-deps.c.jj 2014-08-06 10:34:13.000000000 +0200 +++ gcc/sched-deps.c 2014-08-12 14:12:06.625193731 +0200 @@ -4751,6 +4751,24 @@ find_inc (struct mem_inc_info *mii, bool "inc conflicts with store failure.\n"); goto next; } + + /* The inc instruction could have clobbers, make sure those + registers are not used in mem insn. */ + FOR_EACH_INSN_DEF (def, mii->inc_insn) + if (!reg_overlap_mentioned_p (DF_REF_REG (def), mii->mem_reg0)) + { + df_ref use; + FOR_EACH_INSN_USE (use, mii->mem_insn) + if (reg_overlap_mentioned_p (DF_REF_REG (def), + DF_REF_REG (use))) + { + if (sched_verbose >= 5) + fprintf (sched_dump, + "inc clobber used in store failure.\n"); + goto next; + } + } + newaddr = mii->inc_input; if (mii->mem_index != NULL_RTX) newaddr = gen_rtx_PLUS (GET_MODE (newaddr), newaddr,