From 7f46559c8282d7e6e9b2b8d67cd390b7775ce1bc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Nov 2018 17:40:53 +0100 Subject: [PATCH] re PR middle-end/88032 (ICE in operand_subword_force, at emit-rtl.c:1793) PR middle-end/88032 * optabs.c (expand_binop): For op0_mode use GET_MODE (op0), unless it is VOIDmode, in which case use int_mode. Similarly for op1_mode. From-SVN: r266216 --- gcc/ChangeLog | 6 ++++++ gcc/optabs.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7171079517..a6881d218be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-16 Jakub Jelinek + + PR middle-end/88032 + * optabs.c (expand_binop): For op0_mode use GET_MODE (op0), unless it + is VOIDmode, in which case use int_mode. Similarly for op1_mode. + 2018-11-16 Eric Botcazou * tree-switch-conversion.h (switch_decision_tree::emit_case_nodes): Add diff --git a/gcc/optabs.c b/gcc/optabs.c index c7d1f22e7a8..130b1182ef0 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1377,8 +1377,12 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1, start_sequence (); /* Do the actual arithmetic. */ - enum machine_mode op0_mode = CONSTANT_P (op0) ? int_mode : VOIDmode; - enum machine_mode op1_mode = CONSTANT_P (op1) ? int_mode : VOIDmode; + enum machine_mode op0_mode = GET_MODE (op0); + enum machine_mode op1_mode = GET_MODE (op1); + if (op0_mode == VOIDmode) + op0_mode = int_mode; + if (op1_mode == VOIDmode) + op1_mode = int_mode; for (i = 0; i < GET_MODE_BITSIZE (int_mode) / BITS_PER_WORD; i++) { rtx target_piece = operand_subword (target, i, 1, int_mode); -- 2.30.2