diff options
author | Sudakshina Das <sudi.das@arm.com> | 2018-01-11 10:46:59 +0000 |
---|---|---|
committer | Sudakshina Das <sudi@gcc.gnu.org> | 2018-01-11 10:46:59 +0000 |
commit | f8f77d4d0028e99035a48626c6e53ebbe2448798 (patch) | |
tree | a7edf0de0080b6461ea0a4b6a5a37f3aea77a792 | |
parent | 69a350853900f6b6f9775deb95efff942020a55f (diff) | |
download | gcc-f8f77d4d0028e99035a48626c6e53ebbe2448798.zip gcc-f8f77d4d0028e99035a48626c6e53ebbe2448798.tar.gz gcc-f8f77d4d0028e99035a48626c6e53ebbe2448798.tar.bz2 |
[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 <sudi.das@arm.com>
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 <sudi.das@arm.com>
PR target/82096
* gcc.c-torture/compile/pr82096.c: New test.
From-SVN: r256526
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/expmed.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr82096.c | 9 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e5f46a..d34418e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-11 Sudakshina Das <sudi.das@arm.com> + + PR target/82096 + * expmed.c (emit_store_flag_force): Swap if const op0 + and change VOIDmode to mode of op0. + 2018-01-11 Richard Sandiford <richard.sandiford@linaro.org> PR rtl-optimization/83761 diff --git a/gcc/expmed.c b/gcc/expmed.c index f34ed93..35ce82b 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6d2045..3b49b86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-11 Sudakshina Das <sudi.das@arm.com> + + PR target/82096 + * gcc.c-torture/compile/pr82096.c: New test. + 2018-01-11 Ed Schonberg <schonberg@adacore.com> * gnat.dg/bip_overlay.adb, gnat.dg/bip_overlay.ads: New testcase. 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 0000000..9fed28c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr82096.c @@ -0,0 +1,9 @@ +/* { 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)); +} |