PR c/79199
* fold-const.c (operand_equal_p) [COND_EXPR]: Use OP_SAME_WITH_NULL
for the third operand.
* c-c++-common/Wduplicated-branches-13.c: New test.
From-SVN: r244928
+2017-01-26 Marek Polacek <polacek@redhat.com>
+
+ PR c/79199
+ * fold-const.c (operand_equal_p) [COND_EXPR]: Use OP_SAME_WITH_NULL
+ for the third operand.
+
2017-01-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/79236
TREE_OPERAND (arg1, 0), flags));
case COND_EXPR:
- if (! OP_SAME (1) || ! OP_SAME (2))
+ if (! OP_SAME (1) || ! OP_SAME_WITH_NULL (2))
return 0;
flags &= ~OEP_ADDRESS_OF;
return OP_SAME (0);
+2017-01-26 Marek Polacek <polacek@redhat.com>
+
+ PR c/79199
+ * c-c++-common/Wduplicated-branches-13.c: New test.
+
2017-01-26 David Sherwood <david.sherwood@arm.com>
PR middle-end/79212
--- /dev/null
+/* PR c/79199 */
+/* { dg-do compile } */
+/* { dg-options "-Wduplicated-branches" } */
+
+unsigned int a, b, c, d, e;
+void
+fn1 (void)
+{
+ if (0) /* { dg-warning "this condition has identical branches" } */
+ {
+ if (d > 4294967293)
+ (void) 5;
+ c = d;
+ b = e | a;
+ }
+ else
+ {
+ if (d > 4294967293)
+ (void) 5;
+ c = d;
+ b = e | a;
+ }
+}