]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/86025 (ICE with -Wduplicated-branches and OpenMP critical)
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 21:28:36 +0000 (23:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:28:36 +0000 (23:28 +0200)
Backported from mainline
2018-06-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/86025
* tree.c (inchash::add_expr): Handle IDENTIFIER_NODE.

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

From-SVN: r261966

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

index 99f05e45328b947f6305072e43356d4b98e00bcf..28fe85fdfc2b853b9602d861f7fb13176acd2c78 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-06-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/86025
+       * tree.c (inchash::add_expr): Handle IDENTIFIER_NODE.
+
        2018-05-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/85659
index 55f2c12e8ad5574b61034c4be8a92dd300016cc4..e0d1544a7a4a878d910601483a91dad2dfa55bfe 100644 (file)
@@ -6,6 +6,11 @@
        PR c++/85662
        * g++.dg/ext/offsetof3.C: New test.
 
+       2018-06-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/86025
+       * c-c++-common/gomp/pr86025.c: New test.
+
        2018-05-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/85952
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 0e98f53af96045e36e52ac85c25f7d3bd191c1a2..c28f87606aba4b2547dad8acf9b29fbcfea04b9f 100644 (file)
@@ -7888,6 +7888,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