diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-03-03 10:42:34 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-09-17 11:21:01 +0200 |
commit | 3549a5cabdfd4ebb197da99f247d0abad0ba55b5 (patch) | |
tree | 26281da213c364dfed4383e522f091d31d74af53 /gcc/explow.c | |
parent | e1fdce3a0d7064957639949a1ab0fe4a282012c8 (diff) | |
download | gcc-3549a5cabdfd4ebb197da99f247d0abad0ba55b5.zip gcc-3549a5cabdfd4ebb197da99f247d0abad0ba55b5.tar.gz gcc-3549a5cabdfd4ebb197da99f247d0abad0ba55b5.tar.bz2 |
explow: Fix ICE caused by plus_constant [PR94002]
The following testcase ICEs in cross to riscv64-linux. The problem is
that we have a DImode integral constant (that doesn't fit into SImode),
which is pushed into a constant pool and later access just the first half of
it using a MEM. When plus_constant is called on such a MEM, if the constant
has mode, we verify the mode, but if it doesn't, we don't and ICE later on
when we think the CONST_INT is a valid SImode constant.
2020-03-03 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/94002
* explow.c (plus_constant): Punt if cst has VOIDmode and
get_pool_mode is different from mode.
* gcc.dg/pr94002.c: New test.
(cherry picked from commit e913d4f4771e04d4254bf6c0e720fec5e324a898)
Diffstat (limited to 'gcc/explow.c')
-rw-r--r-- | gcc/explow.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/explow.c b/gcc/explow.c index 72e5270..79c781c 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -129,6 +129,9 @@ plus_constant (machine_mode mode, rtx x, poly_int64 c, bool inplace) cst = gen_lowpart (mode, cst); gcc_assert (cst); } + else if (GET_MODE (cst) == VOIDmode + && get_pool_mode (XEXP (x, 0)) != mode) + break; if (GET_MODE (cst) == VOIDmode || GET_MODE (cst) == mode) { tem = plus_constant (mode, cst, c); |