diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-03-03 10:42:34 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-03-03 10:42:34 +0100 |
commit | 0ab503d34f2a8c22262ceefea6c882ae2ff75230 (patch) | |
tree | 6acca675299dafaf4c74ae6ebe92130898c90edf /gcc/explow.c | |
parent | 02ae0e08a93f41022d1584054cf6111548c0d954 (diff) | |
download | gcc-0ab503d34f2a8c22262ceefea6c882ae2ff75230.zip gcc-0ab503d34f2a8c22262ceefea6c882ae2ff75230.tar.gz gcc-0ab503d34f2a8c22262ceefea6c882ae2ff75230.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.
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 77f0c07..b838f03 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -128,6 +128,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); |