view libgomp/testsuite/libgomp.oacc-c++/pr71959.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

// { 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;
}