]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE in cp_omp_mappable_type_1
authorJakub Jelinek <jakub@redhat.com>
Mon, 8 Jul 2019 22:08:27 +0000 (22:08 +0000)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 3 Mar 2020 11:49:47 +0000 (12:49 +0100)
2019-07-09  Andrew Stubbs  <ams@codesourcery.com>

Backport from mainline
2019-07-08  Jakub Jelinek  <jakub@redhat.com>

PR c++/91110
* decl2.c (cp_omp_mappable_type_1): Don't emit any note for
error_mark_node type.

* g++.dg/gomp/pr91110.C: New test.

(cherry picked from openacc-gcc-9-branch commit
d6b6e2be68c197f41e19350df017685e652893ff)

gcc/cp/ChangeLog.omp
gcc/cp/decl2.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/g++.dg/gomp/pr91110.C [new file with mode: 0644]

index 11ed1e729ef3f4e8bd6ec22c31f0edf3db0181fb..8306bd04bc32446c88e167137c428555747a242b 100644 (file)
@@ -1,3 +1,12 @@
+2019-07-09  Andrew Stubbs  <ams@codesourcery.com>
+
+       Backport from mainline:
+       2019-07-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/91110
+       * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
+       error_mark_node type.
+
 2019-07-04  Andrew Stubbs  <ams@codesourcery.com>
 
        Backport from mainline:
index b10f7306f34b222aa92bb9e73bbed11e99f75f84..37a95b9f5b7f41397438c87a2f3d26c6039232dd 100644 (file)
@@ -1416,7 +1416,7 @@ cp_omp_mappable_type_1 (tree type, bool notes)
   /* Mappable type has to be complete.  */
   if (type == error_mark_node || !COMPLETE_TYPE_P (type))
     {
-      if (notes)
+      if (notes && type != error_mark_node)
        {
          tree decl = TYPE_MAIN_DECL (type);
          inform ((decl ? DECL_SOURCE_LOCATION (decl) : input_location),
index fc20b357f3f085476cf50fe103ad4832f07e670b..deddcc50ce15811331cf0d518eff48b6e52f821f 100644 (file)
@@ -1,3 +1,11 @@
+2019-07-09  Andrew Stubbs  <ams@codesourcery.com>
+
+       Backport from mainline:
+       2019-07-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/91110
+       * g++.dg/gomp/pr91110.C: New test.
+
 2019-07-04  Andrew Stubbs  <ams@codesourcery.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/gomp/pr91110.C b/gcc/testsuite/g++.dg/gomp/pr91110.C
new file mode 100644 (file)
index 0000000..332c99a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/91110
+// { dg-do compile }
+
+void
+foo ()
+{
+  X b[2];      // { dg-error "'X' was not declared in this scope" }
+  b[0] = 1;    // { dg-error "'b' was not declared in this scope" }
+  #pragma omp target map(to: b)        // { dg-error "'b' does not have a mappable type in 'map' clause" }
+  ;
+}