+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>
PR target/70858
{
if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK))
{
- inchash::hash hstate0 (0), hstate1 (0);
- inchash::add_expr (arg0, hstate0, flags);
- inchash::add_expr (arg1, hstate1, flags);
- hashval_t h0 = hstate0.end ();
- hashval_t h1 = hstate1.end ();
- gcc_assert (h0 == h1);
+ if (arg0 != arg1)
+ {
+ inchash::hash hstate0 (0), hstate1 (0);
+ inchash::add_expr (arg0, hstate0, flags);
+ inchash::add_expr (arg1, hstate1, flags);
+ hashval_t h0 = hstate0.end ();
+ hashval_t h1 = hstate1.end ();
+ gcc_assert (h0 == h1);
+ }
return 1;
}
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>
PR target/70858
--- /dev/null
+/* 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;
+}
case PLACEHOLDER_EXPR:
/* The node itself doesn't matter. */
return;
+ case BLOCK:
+ case OMP_CLAUSE:
+ /* Ignore. */
+ return;
case TREE_LIST:
/* A list of expressions, for a CALL_EXPR or as the elements of a
VECTOR_CST. */
}
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:
/* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
Otherwise nodes that compare equal according to operand_equal_p might