summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c++/pr71959.C
blob: bf27a75c784ab77b56557f49651a6f28d0e8deb9 (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
// { dg-additional-sources "pr71959-aux.cc" }

// PR lto/71959 ICEd LTO due to mismatch between writing & reading behaviour

struct Iter
{
  int *cursor;

  Iter(int *cursor_) : cursor(cursor_) {}

  int *point() const { return cursor; }
};

#pragma acc routine seq
int one () { return 1; }

struct Apply
{
  static void apply (int (*fn)(), Iter out)
  { *out.point() = fn (); }
};

int main ()
{
  int x;

#pragma acc parallel copyout(x)
  Apply::apply (one, Iter (&x));

  return x != 1;
}