diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 485fc09464ad..4a0e473afd73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-03-25 Jakub Jelinek + + PR tree-optimization/94300 + * tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): If pd.offset + is positive, make sure that off + size isn't larger than needed_len. + 2020-03-25 Richard Biener Jakub Jelinek diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a428085aabb..2a39af6feabd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-03-25 Jakub Jelinek + PR tree-optimization/94300 + * gcc.target/i386/avx512f-pr94300.c: New test. + PR debug/94283 * gcc.dg/pr94283.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr94300.c b/gcc/testsuite/gcc.target/i386/avx512f-pr94300.c new file mode 100644 index 000000000000..7593408dae99 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr94300.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/94300 */ +/* { dg-do run { target { avx512f } } } */ +/* { dg-options "-O1 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512" } */ + +#include "avx512f-check.h" + +typedef double V __attribute__((vector_size (64))); + +static void +avx512f_test (void) +{ + double mem[16]; + const V a = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 }; + const V b = { 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0 }; + V c; + __builtin_memcpy (mem, &a, 64); + __builtin_memcpy (mem + 8, &b, 64); + __builtin_memcpy (&c, mem + 4, 64); + if (c[5] != 9.0) + __builtin_abort (); +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 150ddad3e69f..fd74809ca6ea 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2058,6 +2058,8 @@ vn_walk_cb_data::push_partial_def (pd_data pd, shift_bytes_in_array_left (this_buffer, len + 1, amnt); unsigned int off = pd.offset / BITS_PER_UNIT; gcc_assert (off < needed_len); + size = MIN (size, + (HOST_WIDE_INT) (needed_len - off) * BITS_PER_UNIT); p = buffer + off; if (amnt + size < BITS_PER_UNIT) {