From: uweigand Date: Thu, 13 Nov 2014 14:13:53 +0000 (+0000) Subject: * optabs.c (prepare_operand): Gracefully fail if the mode of X X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a527032f2a3bdc908e6916df42553d56a7cfa6ff;p=thirdparty%2Fgcc.git * optabs.c (prepare_operand): Gracefully fail if the mode of X does not match the operand mode expected by the insn pattern. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217501 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d2f4db5362e..dca1d5a3da0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-11-13 Ulrich Weigand + + * optabs.c (prepare_operand): Gracefully fail if the mode of X + does not match the operand mode expected by the insn pattern. + 2014-11-13 Richard Biener * match.pd: Add tcc_comparison, inverted_tcc_comparison diff --git a/gcc/optabs.c b/gcc/optabs.c index 6278d7daad14..3376f2dfbc3c 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4308,9 +4308,12 @@ prepare_operand (enum insn_code icode, rtx x, int opnum, machine_mode mode, if (!insn_operand_matches (icode, opnum, x)) { + machine_mode op_mode = insn_data[(int) icode].operand[opnum].mode; if (reload_completed) return NULL_RTX; - x = copy_to_mode_reg (insn_data[(int) icode].operand[opnum].mode, x); + if (GET_MODE (x) != op_mode && GET_MODE (x) != VOIDmode) + return NULL_RTX; + x = copy_to_mode_reg (op_mode, x); } return x;