From 063700a6d28128dcabfb1d54b5fea4e7408df56c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Mar 2018 12:37:58 +0200 Subject: 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 --- gcc/testsuite/c-c++-common/Wduplicated-branches-14.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/Wduplicated-branches-14.c (limited to 'gcc/testsuite/c-c++-common/Wduplicated-branches-14.c') diff --git a/gcc/testsuite/c-c++-common/Wduplicated-branches-14.c b/gcc/testsuite/c-c++-common/Wduplicated-branches-14.c new file mode 100644 index 0000000..81be1ac --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wduplicated-branches-14.c @@ -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; +} -- cgit v1.1