1 /* Test dynamic mapping of separate structure members. */
2
3 #include <assert.h>
4 #include <stdio.h>
5 #include <openacc.h>
6
7 struct s
8 {
9 char a;
10 float b;
11 };
12
13 int main ()
14 {
15 struct s s;
16
17 #pragma acc enter data create(s.a)
18 assert (acc_is_present (&s.a, sizeof s.a));
19
20 fprintf (stderr, "CheCKpOInT1\n");
21 /* { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } */
22 #pragma acc enter data create(s.b)
23 /* { dg-output "(\n|\r\n|\r)libgomp: Trying to map into device \\\[\[0-9a-fA-FxX.\]+\\\) structure element when other mapped elements from the same structure weren't mapped together with it(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing).
24 { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all.
25 { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log. */
26 fprintf (stderr, "CheCKpOInT2\n");
27 /* { dg-output "CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } */
28 assert (acc_is_present (&s.b, sizeof s.b));
29
30 //TODO PR95236
31 assert (acc_is_present (&s, sizeof s));
32
33 return 0;
34 }