aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-03-29 12:37:58 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-03-29 12:37:58 +0200
commit063700a6d28128dcabfb1d54b5fea4e7408df56c (patch)
treec59d98270fe371507005e2bd264ca89f620eb47a /gcc/testsuite
parent52df8bd93305f5ccd6a78eeebef9eb85c2208fed (diff)
downloadgcc-063700a6d28128dcabfb1d54b5fea4e7408df56c.zip
gcc-063700a6d28128dcabfb1d54b5fea4e7408df56c.tar.gz
gcc-063700a6d28128dcabfb1d54b5fea4e7408df56c.tar.bz2
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
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/Wduplicated-branches-14.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c5ee018..89712e3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
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;
+}