diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-04-07 09:20:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-04-07 09:20:42 +0200 |
commit | eda71a9eeaaf1ea16ba56d8cc5a4eb194f6025f7 (patch) | |
tree | b1acf024b403009d0a3344de142b9f251ad1c416 /gcc/fold-const.c | |
parent | f1a0afe2aa1447c2d7962f52e8e278c40ba5fe19 (diff) | |
download | gcc-eda71a9eeaaf1ea16ba56d8cc5a4eb194f6025f7.zip gcc-eda71a9eeaaf1ea16ba56d8cc5a4eb194f6025f7.tar.gz gcc-eda71a9eeaaf1ea16ba56d8cc5a4eb194f6025f7.tar.bz2 |
re PR tree-optimization/85257 (wrong code with -O -fno-tree-ccp and reading zeroed vector member)
PR tree-optimization/85257
* fold-const.c (native_encode_vector): If not all elts could fit
and off is -1, return 0 rather than offset.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Pass
(offseti - offset2) / BITS_PER_UNIT as 4th argument to
native_encode_expr. Verify len * BITS_PER_UNIT >= maxsizei. Don't
adjust buffer in native_interpret_expr call.
* gcc.dg/pr85257.c: New test.
From-SVN: r259206
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3134f8e..3a99b66 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7307,7 +7307,7 @@ native_encode_vector (const_tree expr, unsigned char *ptr, int len, int off) return 0; offset += res; if (offset >= len) - return offset; + return (off == -1 && i < count - 1) ? 0 : offset; if (off != -1) off = 0; } |