http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56195
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-07 19:47:04 UTC --- So something like: --- lra-constraints.c.jj 2013-02-07 18:34:39.000000000 +0100 +++ lra-constraints.c 2013-02-07 20:41:17.051986353 +0100 @@ -421,7 +421,21 @@ get_reload_reg (enum op_type type, enum if (rtx_equal_p (curr_insn_input_reloads[i].input, original) && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class)) { - *result_reg = curr_insn_input_reloads[i].reg; + rtx reg = curr_insn_input_reloads[i].reg; + /* If input is equal to original and both are VOIDmode, + GET_MODE (reg) might be still different from mode. + Ensure we don't return *result_reg with wrong mode. */ + if (GET_MODE (reg) != mode) + { + if (GET_MODE_SIZE (GET_MODE (reg)) < GET_MODE_SIZE (mode)) + continue; + reg = simplify_subreg (mode, reg, GET_MODE (reg), + subreg_lowpart_offset (mode, + GET_MODE (reg))); + if (reg == NULL_RTX || !REG_P (reg)) + continue; + } + *result_reg = reg; regno = REGNO (*result_reg); if (lra_dump_file != NULL) { ?