diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-06-16 21:03:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-06-16 21:03:05 +0200 |
commit | 283635f9bd93d373b93efc1f6ffdd215f93be5fe (patch) | |
tree | 5e58a24aa0c773a550f62bd0edd6c36e5155b9cc /libgomp/testsuite | |
parent | 4389cf2551f89c0e060479396786f74aae14d3b2 (diff) | |
download | gcc-283635f9bd93d373b93efc1f6ffdd215f93be5fe.zip gcc-283635f9bd93d373b93efc1f6ffdd215f93be5fe.tar.gz gcc-283635f9bd93d373b93efc1f6ffdd215f93be5fe.tar.bz2 |
gimplify.c (gimplify_scan_omp_clauses): Handle COMPONENT_REFs with base of reference to struct.
* gimplify.c (gimplify_scan_omp_clauses): Handle COMPONENT_REFs
with base of reference to struct.
* parser.c (cp_parser_omp_var_list_no_open): Call
convert_from_reference before cp_parser_postfix_dot_deref_expression.
* semantics.c (finish_omp_clauses): Don't ICE when
processing_template_decl when checking for bitfields and unions.
Look through REFERENCE_REF_P as base of COMPONENT_REF.
* testsuite/libgomp.c++/target-20.C: New test.
From-SVN: r237538
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/target-20.C | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/target-20.C b/libgomp/testsuite/libgomp.c++/target-20.C new file mode 100644 index 0000000..a722ec0 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/target-20.C @@ -0,0 +1,80 @@ +extern "C" void abort (); +struct S { int a, b, c, d; }; + +void +foo (S &s) +{ + int err; + #pragma omp target map (s.b, s.d) map (from: err) + { + err = s.b != 21 || s.d != 24; + s.b++; s.d++; + } + if (err || s.b != 22 || s.d != 25) + abort (); + #pragma omp target data map (s.b, s.d) + { + #pragma omp target map (alloc: s.b, s.d) map (from: err) + { + err = s.b != 22 || s.d != 25; + s.b++; s.d++; + } + } + if (err || s.b != 23 || s.d != 26) + abort (); + #pragma omp target data map (s) + { + #pragma omp target map (alloc: s.b, s.d) map (from: err) + { + err = s.b != 23 || s.d != 26; + s.b++; s.d++; + } + } + if (err || s.b != 24 || s.d != 27) + abort (); +} + +template <typename T, typename U> +void +bar (S &s, T &t, U u) +{ + int err; + #pragma omp target map (s.b, s.d, t.b, t.d, u.b, u.d) map (from: err) + { + err = s.b != 21 || s.d != 24 || t.b != 73 || t.d != 82 || u.b != 31 || u.d != 37; + s.b++; s.d++; t.b++; t.d++; u.b++; u.d++; + } + if (err || s.b != 22 || s.d != 25 || t.b != 74 || t.d != 83 || u.b != 32 || u.d != 38) + abort (); + #pragma omp target data map (s.b, s.d, t.b, t.d, u.b, u.d) + { + #pragma omp target map (alloc: s.b, s.d, t.b, t.d, u.b, u.d) map (from: err) + { + err = s.b != 22 || s.d != 25 || t.b != 74 || t.d != 83 || u.b != 32 || u.d != 38; + s.b++; s.d++; t.b++; t.d++; u.b++; u.d++; + } + } + if (err || s.b != 23 || s.d != 26 || t.b != 75 || t.d != 84 || u.b != 33 || u.d != 39) + abort (); + #pragma omp target data map (s, t, u) + { + #pragma omp target map (alloc: s.b, s.d, t.b, t.d, u.b, u.d) map (from: err) + { + err = s.b != 23 || s.d != 26 || t.b != 75 || t.d != 84 || u.b != 33 || u.d != 39; + s.b++; s.d++; t.b++; t.d++; u.b++; u.d++; + } + } + if (err || s.b != 24 || s.d != 27 || t.b != 76 || t.d != 85 || u.b != 34 || u.d != 40) + abort (); +} + +int +main () +{ + S s = { 1, 21, 2, 24 }; + foo (s); + S s2 = { 3, 21, 4, 24 }; + S t = { 5, 73, 6, 82 }; + S u = { 7, 31, 8, 37 }; + bar <S, S &> (s2, t, u); +} |