From 6fad471b8f1a62c385624bf4cecbd57c397bbe91 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 13 Nov 2014 14:13:53 +0000 Subject: [PATCH] optabs.c (prepare_operand): Gracefully fail if the mode of X does not match the operand mode expected by... * optabs.c (prepare_operand): Gracefully fail if the mode of X does not match the operand mode expected by the insn pattern. From-SVN: r217501 --- gcc/ChangeLog | 5 +++++ gcc/optabs.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d2f4db5362..dca1d5a3da0 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 6278d7daad1..3376f2dfbc3 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;