re PR c/85094 (-g with any optimization suppresses -Wduplicated-branches)
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
This commit is contained in:
parent
52df8bd933
commit
063700a6d2
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -3479,7 +3479,8 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -3492,6 +3493,10 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
|
||||
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;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
16
gcc/testsuite/c-c++-common/Wduplicated-branches-14.c
Normal file
16
gcc/testsuite/c-c++-common/Wduplicated-branches-14.c
Normal file
@ -0,0 +1,16 @@
|
||||
/* 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user