| 1 |
extern "C" void abort (); |
| 2 |
struct S { int a; }; |
| 3 |
#ifdef __SIZEOF_INT128__ |
| 4 |
typedef __int128 T; |
| 5 |
#else |
| 6 |
typedef long long int T; |
| 7 |
#endif |
| 8 |
|
| 9 |
void |
| 10 |
foo (T a, int b, struct S c) |
| 11 |
{ |
| 12 |
int err; |
| 13 |
#pragma omp target firstprivate (a, b, c) map(from:err) |
| 14 |
{ |
| 15 |
err = 0; |
| 16 |
if (a != 131 || b != 276 || c.a != 59) |
| 17 |
err = 1; |
| 18 |
a = 936; |
| 19 |
b = 27; |
| 20 |
c.a = 98; |
| 21 |
if (a != 936 || b != 27 || c.a != 98) |
| 22 |
err = 1; |
| 23 |
} |
| 24 |
if (err || a != 131 || b != 276 || c.a != 59) |
| 25 |
abort (); |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
bar (T &a, int &b, struct S &c) |
| 30 |
{ |
| 31 |
int err; |
| 32 |
#pragma omp target firstprivate (a, b, c) map(from:err) |
| 33 |
{ |
| 34 |
err = 0; |
| 35 |
if (a != 131 || b != 276 || c.a != 59) |
| 36 |
err = 1; |
| 37 |
a = 936; |
| 38 |
b = 27; |
| 39 |
c.a = 98; |
| 40 |
if (a != 936 || b != 27 || c.a != 98) |
| 41 |
err = 1; |
| 42 |
} |
| 43 |
if (err || a != 131 || b != 276 || c.a != 59) |
| 44 |
abort (); |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
main () |
| 49 |
{ |
| 50 |
T a = 131; |
| 51 |
int b = 276; |
| 52 |
struct S c; |
| 53 |
c.a = 59; |
| 54 |
foo (a, b, c); |
| 55 |
bar (a, b, c); |
| 56 |
if (a != 131 || b != 276 || c.a != 59) |
| 57 |
abort (); |
| 58 |
} |