From: Sudakshina Das Date: Wed, 21 Feb 2018 12:50:31 +0000 (+0000) Subject: Fix emit_store_flag_force () function to fix ICE in int_mode_for_mode, X-Git-Tag: releases/gcc-6.5.0~511 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d33e9c7ac81d7ace853d824b9dcb055be8e76e0;p=thirdparty%2Fgcc.git Fix emit_store_flag_force () function to fix ICE in int_mode_for_mode, at stor-layout.c:403 with arm-linux-gnueabi. *** gcc/ChangeLog *** 2018-02-21 Sudakshina Das Backport from trunk 2018-01-10 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 *** 2018-02-21 Sudakshina Das Backport from trunk 2018-01-12 Sudakshina Das * gcc.c-torture/compile/pr82096.c: Add dg-skip-if directive. Backport from trunk 2018-01-10 Sudakshina Das PR target/82096 * gcc.c-torture/compile/pr82096.c: New test. From-SVN: r257871 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 059f5e968d25..cebcf8500bd1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-02-21 Sudakshina Das + + Backport from trunk + 2018-01-10 Sudakshina Das + + PR target/82096 + * expmed.c (emit_store_flag_force): Swap if const op0 + and change VOIDmode to mode of op0. + 2018-02-15 Michael Meissner Back port from trunk diff --git a/gcc/expmed.c b/gcc/expmed.c index 55398a045042..80edb0d03fb7 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5917,6 +5917,18 @@ 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f813486e0a5..e940f712802d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2018-02-21 Sudakshina Das + + Backport from trunk + 2018-01-12 Sudakshina Das + + * gcc.c-torture/compile/pr82096.c: Add dg-skip-if + directive. + + Backport from trunk + 2018-01-10 Sudakshina Das + + PR target/82096 + * gcc.c-torture/compile/pr82096.c: New test. + 2018-02-16 Eric Botcazou PR ada/84277 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82096.c b/gcc/testsuite/gcc.c-torture/compile/pr82096.c new file mode 100644 index 000000000000..d144b70585fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr82096.c @@ -0,0 +1,11 @@ +/* { dg-require-effective-target arm_arch_v5t_ok { target arm*-*-* } } */ +/* { dg-skip-if "Do not combine float-abi values" { arm*-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ +/* { dg-additional-options "-march=armv5t -mthumb -mfloat-abi=soft" { target arm*-*-* } } */ + +static long long AL[24]; + +int +check_ok (void) +{ + return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 0x1234567890ll)); +}