re PR c++/86025 (ICE with -Wduplicated-branches and OpenMP critical)
authorJakub Jelinek <jakub@redhat.com>
Mon, 4 Jun 2018 07:27:52 +0000 (09:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 4 Jun 2018 07:27:52 +0000 (09:27 +0200)
PR c++/86025
* tree.c (inchash::add_expr): Handle IDENTIFIER_NODE.

* c-c++-common/gomp/pr86025.c: New test.

From-SVN: r261137

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/pr86025.c [new file with mode: 0644]
gcc/tree.c

index 4faeadc8a47e9fcb1110301380591d0fec9e0778..3882e6098cfc7f9a1950974152a1ecae699c003a 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/86025
+       * tree.c (inchash::add_expr): Handle IDENTIFIER_NODE.
+
 2018-06-03  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR tree-optimization/86034
index c3a9bcaf17639efbe8d9f9126e8670bcb6ee29ed..7352e41c3fcd5f5a9e5acbdbed802c44bec2f4b0 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/86025
+       * c-c++-common/gomp/pr86025.c: New test.
+
 2018-06-03  Andreas Schwab  <schwab@linux-m68k.org>
 
        * gcc.target/powerpc/altivec-7.c: Remove extra brace.
diff --git a/gcc/testsuite/c-c++-common/gomp/pr86025.c b/gcc/testsuite/c-c++-common/gomp/pr86025.c
new file mode 100644 (file)
index 0000000..c1c5079
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR c++/86025 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Wduplicated-branches" } */
+
+int i;
+
+void
+foo (int x)
+{
+  if (x)
+    {
+      #pragma omp critical (foo)
+      i++;
+    }
+  else
+    {
+      #pragma omp critical
+      i++;
+    }
+}
index 85ce99373db9044a0843e394de01520ee50ecea3..2c75953542b1db4aa638882252f87eb76c3ba1cc 100644 (file)
@@ -7360,6 +7360,9 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
       for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
        inchash::add_expr (TREE_VEC_ELT (t, i), hstate, flags);
       return;
+    case IDENTIFIER_NODE:
+      hstate.add_object (IDENTIFIER_HASH_VALUE (t));
+      return;
     case FUNCTION_DECL:
       /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
         Otherwise nodes that compare equal according to operand_equal_p might