summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-15 11:27:07 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-15 11:27:07 +0000
commit2aa84557e33103670f33aa78ff9b63dd1f549117 (patch)
treed95d5246a3e6269761230c471693bd41fd2b00d2 /libgomp
parenta1c316b267365518d47bc5a744bba37cac17eebb (diff)
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com> PR c++/81314 * cp-gimplify.c (omp_var_to_track): Look through references. (omp_cxx_notice_variable): Likewise. * testsuite/libgomp.c++/pr81314.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@252806 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog8
-rw-r--r--libgomp/testsuite/libgomp.c++/pr81314.C38
2 files changed, 46 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 93bfedf43c07..59a2ff88b0ed 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81314
+ * testsuite/libgomp.c++/pr81314.C: New test.
+
2017-09-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/testsuite/libgomp.c++/pr81314.C b/libgomp/testsuite/libgomp.c++/pr81314.C
new file mode 100644
index 000000000000..afe89438bd3f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/pr81314.C
@@ -0,0 +1,38 @@
+// PR c++/81314
+// { dg-do link }
+
+template <int N>
+struct S {
+ S () { s = 0; }
+ S (const S &x) { s = x.s; }
+ ~S () {}
+ int s;
+};
+
+void
+foo (S<2> &x)
+{
+ #pragma omp taskloop
+ for (int i = 0; i < 100; ++i)
+ x.s++;
+}
+
+void
+bar (S<3> &x)
+{
+ #pragma omp task
+ x.s++;
+}
+
+int
+main ()
+{
+ S<2> s;
+ S<3> t;
+ #pragma omp parallel
+ #pragma omp master
+ {
+ foo (s);
+ bar (t);
+ }
+}