The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67954
The patch was bootstrapped on x86/x86-64. The test is too big and was not included to the patch.
Committed as rev. 230893 to gcc-5 branch and as rev. 230894 to trunk.
Index: ChangeLog =================================================================== --- ChangeLog (revision 230887) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2015-11-25 Vladimir Makarov <vmaka...@redhat.com> + + PR rtl-optimization/67954 + * lra-constraints.c (curr_insn_transform): Add check on scratch + pseudo when change class to NO_REGS. Add an assert. + 2015-11-24 Michael Meissner <meiss...@linux.vnet.ibm.com> Backport form mainline Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 230887) +++ lra-constraints.c (working copy) @@ -3738,7 +3738,8 @@ curr_insn_transform (bool check_only_p) assigment pass and the scratch pseudo will be spilled. Spilled scratch pseudos are transformed back to scratches at the LRA end. */ - && lra_former_scratch_operand_p (curr_insn, i)) + && lra_former_scratch_operand_p (curr_insn, i) + && lra_former_scratch_p (REGNO (op))) { int regno = REGNO (op); lra_change_class (regno, NO_REGS, " Change to", true); @@ -3747,6 +3748,8 @@ curr_insn_transform (bool check_only_p) spilled pseudo as there is only one such insn, the current one. */ reg_renumber[regno] = -1; + lra_assert (bitmap_single_bit_set_p + (&lra_reg_info[REGNO (op)].insn_bitmap)); } /* We can do an optional reload. If the pseudo got a hard reg, we might improve the code through inheritance. If