aboutsummaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-10-04 13:39:22 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-10-04 13:39:22 +0000
commit2b5688997f2bfc90fa512f0bb2d010bf8d7a85b6 (patch)
tree12057e6e0c200c7e29f4cef0185ad8e4ef681b0a /gcc/explow.c
parentd96a55858cbdf50f70a7440906ff67f8936c4f08 (diff)
downloadgcc-2b5688997f2bfc90fa512f0bb2d010bf8d7a85b6.zip
gcc-2b5688997f2bfc90fa512f0bb2d010bf8d7a85b6.tar.gz
gcc-2b5688997f2bfc90fa512f0bb2d010bf8d7a85b6.tar.bz2
re PR target/77833 (ICE: in plus_constant, at explow.c:87 with -O -mavx512f)
2016-10-04 Richard Biener <rguenther@suse.de> PR middle-end/77833 * explow.c (plus_constant): Verify the mode of the constant pool offset before calling plus_constant. * gcc.target/i386/pr77833.c: New testcase. From-SVN: r240743
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index 8dcef8b..d8f9dd2 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -114,12 +114,15 @@ plus_constant (machine_mode mode, rtx x, HOST_WIDE_INT c,
cst = gen_lowpart (mode, cst);
gcc_assert (cst);
}
- tem = plus_constant (mode, cst, c);
- tem = force_const_mem (GET_MODE (x), tem);
- /* Targets may disallow some constants in the constant pool, thus
- force_const_mem may return NULL_RTX. */
- if (tem && memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
- return tem;
+ if (GET_MODE (cst) == VOIDmode || GET_MODE (cst) == mode)
+ {
+ tem = plus_constant (mode, cst, c);
+ tem = force_const_mem (GET_MODE (x), tem);
+ /* Targets may disallow some constants in the constant pool, thus
+ force_const_mem may return NULL_RTX. */
+ if (tem && memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
+ return tem;
+ }
}
break;