From f8f77d4d0028e99035a48626c6e53ebbe2448798 Mon Sep 17 00:00:00 2001 From: Sudakshina Das Date: Thu, 11 Jan 2018 10:46:59 +0000 Subject: [PR82096] Fix ICE in int_mode_for_mode with arm-linux-gnueabi The bug reported a particular test di-longlong64-sync-1.c failing when run on arm-linux-gnueabi with options -mthumb -march=armv5t -O[g,1,2,3] and -mthumb -march=armv6 -O[g,1,2,3]. The crash was caused because of the explicit VOIDmode argument that is sent to emit_store_flag_force () and that the emit_store_flag_force () was not handling the VOIDmode adequately. This patch fixes that. ChangeLog entries: *** gcc/ChangeLog *** 2017-01-11 Sudakshina Das PR target/82096 * expmed.c (emit_store_flag_force): Swap if const op0 and change VOIDmode to mode of op0. *** gcc/testsuite/ChangeLog *** 2017-01-11 Sudakshina Das PR target/82096 * gcc.c-torture/compile/pr82096.c: New test. From-SVN: r256526 --- gcc/expmed.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/expmed.c') diff --git a/gcc/expmed.c b/gcc/expmed.c index f34ed9376af..35ce82bbb29 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -6082,6 +6082,17 @@ emit_store_flag_force (rtx target, enum rtx_code code, rtx op0, rtx op1, if (tem != 0) return tem; + /* If one operand is constant, make it the second one. Only do this + if the other operand is not constant as well. */ + if (swap_commutative_operands_p (op0, op1)) + { + std::swap (op0, op1); + code = swap_condition (code); + } + + if (mode == VOIDmode) + mode = GET_MODE (op0); + if (!target) target = gen_reg_rtx (word_mode); -- cgit v1.2.1