summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-10-29 14:31:20 +0000
committerJulian Brown <jules@gcc.gnu.org>2018-10-29 14:31:20 +0000
commit87a5ccfb7cbabcf510f7909387a16cc0f73931f3 (patch)
tree1427799828cfe5acd429f9f6512bd95c631c1afc /libgomp
parent5d8c32cb86043e388fddc9833d9c2cd90ed05284 (diff)
downloadgcc-87a5ccfb7cbabcf510f7909387a16cc0f73931f3.tar.gz
[OpenACC] Support C++ "this" in OpenACC directives
2018-10-29 Joseph Myers <joseph@codesourcery.com> Julian Brown <julian@codesourcery.com> * semantics.c (handle_omp_array_sections_1): Allow array sections with "this" pointer for OpenACC. Co-Authored-By: Julian Brown <julian@codesourcery.com> From-SVN: r265591
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/this.C43
2 files changed, 48 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 9c2ae06b4e1..81fae2fb980 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-29 Joseph Myers <joseph@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+
+ * testsuite/libgomp.oacc-c++/this.C: New.
+
2018-09-18 Cesar Philippidis <cesar@codesourcery.com>
* plugin/plugin-nvptx.c (struct cuda_map): New.
diff --git a/libgomp/testsuite/libgomp.oacc-c++/this.C b/libgomp/testsuite/libgomp.oacc-c++/this.C
new file mode 100644
index 00000000000..510c690cf87
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/this.C
@@ -0,0 +1,43 @@
+#include <cstdlib>
+#include <iostream>
+using namespace std;
+
+class test {
+ public:
+ int a;
+
+ test ()
+ {
+ a = -1;
+#pragma acc enter data copyin (this[0:1])
+ }
+
+ ~test ()
+ {
+#pragma acc exit data delete (this[0:1])
+ }
+
+ void set (int i)
+ {
+ a = i;
+#pragma acc update device (this[0:1])
+ }
+
+ int get ()
+ {
+#pragma acc update host (this[0:1])
+ return a;
+ }
+};
+
+int
+main ()
+{
+ test t;
+
+ t.set (4);
+ if (t.get () != 4)
+ abort ();
+
+ return 0;
+}