Hi! This is something that has been reported privately to me. This is in code introduced in https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00660.html and looks indeed like a pasto to me, before the loop there is a very similar set of stmts without the 2 suffix, and unless regno being a hard reg (after possible reg_renumber) implies that regno2 (after possible reg_renumber) is a hard reg, if unlucky we might access out of bounds.
I don't have a testcase for this, but have bootstrapped/regtested it on x86_64-linux and i686-linux, ok for trunk? 2017-09-01 Jakub Jelinek <ja...@redhat.com> * lra-remat.c (reg_overlap_for_remat_p): Fix a pasto. --- gcc/lra-remat.c.jj 2017-05-25 10:37:00.000000000 +0200 +++ gcc/lra-remat.c 2017-09-01 19:42:07.615291583 +0200 @@ -684,7 +684,7 @@ reg_overlap_for_remat_p (lra_insn_reg *r if (regno2 >= FIRST_PSEUDO_REGISTER && reg_renumber[regno2] >= 0) regno2 = reg_renumber[regno2]; - if (regno >= FIRST_PSEUDO_REGISTER) + if (regno2 >= FIRST_PSEUDO_REGISTER) nregs2 = 1; else nregs2 = hard_regno_nregs[regno2][reg->biggest_mode]; Jakub