PR c/85094
* fold-const.c (operand_equal_p): Handle DEBUG_BEGIN_STMT.
For STATEMENT_LIST, pass down OEP_LEXICOGRAPHIC and maybe
OEP_NO_HASH_CHECK for recursive call, to avoid exponential
checking.
* c-c++-common/Wduplicated-branches-14.c: New test.
From-SVN: r258950
+2018-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85094
+ * fold-const.c (operand_equal_p): Handle DEBUG_BEGIN_STMT.
+ For STATEMENT_LIST, pass down OEP_LEXICOGRAPHIC and maybe
+ OEP_NO_HASH_CHECK for recursive call, to avoid exponential
+ checking.
+
2018-03-28 Peter Bergner <bergner@vnet.ibm.com>
PR target/84912
if (tsi_end_p (tsi1) && tsi_end_p (tsi2))
return 1;
if (!operand_equal_p (tsi_stmt (tsi1), tsi_stmt (tsi2),
- OEP_LEXICOGRAPHIC))
+ flags & (OEP_LEXICOGRAPHIC
+ | OEP_NO_HASH_CHECK)))
return 0;
}
}
if (flags & OEP_LEXICOGRAPHIC)
return OP_SAME_WITH_NULL (0);
return 0;
+ case DEBUG_BEGIN_STMT:
+ if (flags & OEP_LEXICOGRAPHIC)
+ return 1;
+ return 0;
default:
return 0;
}
+2018-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85094
+ * c-c++-common/Wduplicated-branches-14.c: New test.
+
2018-03-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84606
--- /dev/null
+/* PR c/85094 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -Wduplicated-branches -g" } */
+
+extern int g;
+
+void
+foo (int r)
+{
+ if (r < 64)
+ g -= 48;
+ else if (r < 80) /* { dg-warning "this condition has identical branches" } */
+ g -= 64 - 45;
+ else
+ g -= 80 - 61;
+}