| 1 |
// { dg-additional-sources "pr71959-aux.cc" } |
| 2 |
|
| 3 |
// PR lto/71959 ICEd LTO due to mismatch between writing & reading behaviour |
| 4 |
|
| 5 |
struct Iter |
| 6 |
{ |
| 7 |
int *cursor; |
| 8 |
|
| 9 |
Iter(int *cursor_) : cursor(cursor_) {} |
| 10 |
|
| 11 |
int *point() const { return cursor; } |
| 12 |
}; |
| 13 |
|
| 14 |
#pragma acc routine seq |
| 15 |
int one () { return 1; } |
| 16 |
|
| 17 |
struct Apply |
| 18 |
{ |
| 19 |
static void apply (int (*fn)(), Iter out) |
| 20 |
{ *out.point() = fn (); } |
| 21 |
}; |
| 22 |
|
| 23 |
int main () |
| 24 |
{ |
| 25 |
int x; |
| 26 |
|
| 27 |
#pragma acc parallel copyout(x) |
| 28 |
Apply::apply (one, Iter (&x)); |
| 29 |
|
| 30 |
return x != 1; |
| 31 |
} |