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
This commit is contained in:
Jakub Jelinek 2015-12-10 11:14:38 +01:00 committed by Jakub Jelinek
parent ee7d29b43f
commit 1ff0a84c3d
5 changed files with 28 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2015-12-10 Jakub Jelinek <jakub@redhat.com>
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.
2015-12-10 Richard Biener <rguenther@suse.de>
PR ipa/68331

View File

@ -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)
{

View File

@ -1,3 +1,8 @@
2015-12-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/68785
* gcc.dg/pr68785.c: New test.
2015-12-10 Richard Biener <rguenther@suse.de>
PR ipa/68331

View File

@ -0,0 +1,9 @@
/* PR tree-optimization/68785 */
/* { dg-do compile } */
/* { dg-options "-O3" } */
int
foo (void)
{
return *(int *) "";
}

View File

@ -1370,8 +1370,9 @@ fully_constant_vn_reference_p (vn_reference_t ref)
else
{
unsigned char buf[MAX_BITSIZE_MODE_ANY_MODE / BITS_PER_UNIT];
if (native_encode_expr (ctor, buf, size, off) > 0)
return native_interpret_expr (ref->type, buf, size);
int len = native_encode_expr (ctor, buf, size, off);
if (len > 0)
return native_interpret_expr (ref->type, buf, len);
}
}
}