From: Richard Biener Date: Tue, 4 Oct 2016 13:39:22 +0000 (+0000) Subject: re PR target/77833 (ICE: in plus_constant, at explow.c:87 with -O -mavx512f) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b5688997f2bfc90fa512f0bb2d010bf8d7a85b6;p=gcc.git re PR target/77833 (ICE: in plus_constant, at explow.c:87 with -O -mavx512f) 2016-10-04 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d182496a509..6e0de29444e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-04 Richard Biener + + PR middle-end/77833 + * explow.c (plus_constant): Verify the mode of the constant + pool offset before calling plus_constant. + 2016-10-04 Richard Biener PR middle-end/77407 diff --git a/gcc/explow.c b/gcc/explow.c index 8dcef8bb350..d8f9dd2e7de 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e6246455ca..9a8692eacf3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-04 Richard Biener + + PR middle-end/77833 + * gcc.target/i386/pr77833.c: New testcase. + 2016-09-26 Jeff Law PR tree-optimization/71550 diff --git a/gcc/testsuite/gcc.target/i386/pr77833.c b/gcc/testsuite/gcc.target/i386/pr77833.c new file mode 100644 index 00000000000..21527fe6e47 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77833.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O -mavx512f" } */ + +typedef unsigned long V __attribute__((vector_size(64))); +typedef unsigned __int128 W __attribute__((vector_size(64))); + +V +foo(int i, V v) +{ + i *= ((W)(V){0, 0, 0, 0, 0, 1, v[0]})[2]; + v[i] = 0; + i--; + return v + i; +}