aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/struct-3-1-1.c
blob: a644ea9c26f389e872c2f576c9f6cabca8bdffb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Test dynamic mapping of separate structure members.  */

#include <assert.h>
#include <stdio.h>
#include <openacc.h>

struct s
{
  char a;
  float b;
};

int main ()
{
  struct s s;

#pragma acc enter data create(s.a)
  assert (acc_is_present (&s.a, sizeof s.a));

  fprintf (stderr, "CheCKpOInT1\n");
  /* { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } */
#pragma acc enter data create(s.b)
  /* { 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).
     { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all.
     { 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.  */
  fprintf (stderr, "CheCKpOInT2\n");
  /* { dg-output "CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } } */
  assert (acc_is_present (&s.b, sizeof s.b));

  //TODO PR95236
  assert (acc_is_present (&s, sizeof s));

  return 0;
}