summaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-12-10 11:14:38 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2015-12-10 11:14:38 +0100
commit1ff0a84c3d3c0e8257a3837bf9f5d7f09f2f131e (patch)
tree9f2935aa763d1201e183b766b7a31df4705c7adb /gcc/gimple-fold.c
parentee7d29b43faf156f55e55dfcb841fa38da2e855a (diff)
downloadgcc-1ff0a84c3d3c0e8257a3837bf9f5d7f09f2f131e.tar.gz
re PR middle-end/68785 (valgrind reports issues with folding on x86_64)
PR tree-optimization/68785 * gimple-fold.c (fold_ctor_reference): Pass return value from native_encode_expr to native_interpret_expr. * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise. * gcc.dg/pr68785.c: New test. From-SVN: r231499
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 6ff5e266d42..6f8ec6f90a6 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -5495,9 +5495,10 @@ fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset,
&& size <= MAX_BITSIZE_MODE_ANY_MODE)
{
unsigned char buf[MAX_BITSIZE_MODE_ANY_MODE / BITS_PER_UNIT];
- if (native_encode_expr (ctor, buf, size / BITS_PER_UNIT,
- offset / BITS_PER_UNIT) > 0)
- return native_interpret_expr (type, buf, size / BITS_PER_UNIT);
+ int len = native_encode_expr (ctor, buf, size / BITS_PER_UNIT,
+ offset / BITS_PER_UNIT);
+ if (len > 0)
+ return native_interpret_expr (type, buf, len);
}
if (TREE_CODE (ctor) == CONSTRUCTOR)
{