Commit 8b80cc21 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/70843 (ICE in add_expr, at tree.c:7913)

	PR middle-end/70843
	* fold-const.c (operand_equal_p): Don't verify hash value equality
	if arg0 == arg1.
	* tree.c (inchash::add_expr): Handle STATEMENT_LIST.  Ignore BLOCK
	and OMP_CLAUSE.

	* gcc.dg/pr70843.c: New test.

From-SVN: r235615
parent 9f405ce1
2016-04-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/70843
* fold-const.c (operand_equal_p): Don't verify hash value equality
if arg0 == arg1.
* tree.c (inchash::add_expr): Handle STATEMENT_LIST. Ignore BLOCK
and OMP_CLAUSE.
2016-04-28 Jakub Jelinek <jakub@redhat.com> 2016-04-28 Jakub Jelinek <jakub@redhat.com>
PR target/70858 PR target/70858
......
...@@ -2756,12 +2756,15 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) ...@@ -2756,12 +2756,15 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
{ {
if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK)) if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK))
{ {
inchash::hash hstate0 (0), hstate1 (0); if (arg0 != arg1)
inchash::add_expr (arg0, hstate0, flags); {
inchash::add_expr (arg1, hstate1, flags); inchash::hash hstate0 (0), hstate1 (0);
hashval_t h0 = hstate0.end (); inchash::add_expr (arg0, hstate0, flags);
hashval_t h1 = hstate1.end (); inchash::add_expr (arg1, hstate1, flags);
gcc_assert (h0 == h1); hashval_t h0 = hstate0.end ();
hashval_t h1 = hstate1.end ();
gcc_assert (h0 == h1);
}
return 1; return 1;
} }
else else
......
2016-04-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/70843
* gcc.dg/pr70843.c: New test.
2016-04-28 Jakub Jelinek <jakub@redhat.com> 2016-04-28 Jakub Jelinek <jakub@redhat.com>
PR target/70858 PR target/70858
......
/* PR middle-end/70843 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
int
foo (int x, int y)
{
return ({ int a = 5; a += x; a *= y; a; }) ? : 2;
}
...@@ -7836,6 +7836,10 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) ...@@ -7836,6 +7836,10 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
case PLACEHOLDER_EXPR: case PLACEHOLDER_EXPR:
/* The node itself doesn't matter. */ /* The node itself doesn't matter. */
return; return;
case BLOCK:
case OMP_CLAUSE:
/* Ignore. */
return;
case TREE_LIST: case TREE_LIST:
/* A list of expressions, for a CALL_EXPR or as the elements of a /* A list of expressions, for a CALL_EXPR or as the elements of a
VECTOR_CST. */ VECTOR_CST. */
...@@ -7854,6 +7858,14 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) ...@@ -7854,6 +7858,14 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
} }
return; return;
} }
case STATEMENT_LIST:
{
tree_stmt_iterator i;
for (i = tsi_start (CONST_CAST_TREE (t));
!tsi_end_p (i); tsi_next (&i))
inchash::add_expr (tsi_stmt (i), hstate, flags);
return;
}
case FUNCTION_DECL: case FUNCTION_DECL:
/* When referring to a built-in FUNCTION_DECL, use the __builtin__ form. /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
Otherwise nodes that compare equal according to operand_equal_p might Otherwise nodes that compare equal according to operand_equal_p might
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment