| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-fdump-tree-original" } |
| 3 |
|
| 4 |
int x, y; |
| 5 |
|
| 6 |
class C { |
| 7 |
int x, y; |
| 8 |
|
| 9 |
public: |
| 10 |
int foo(); |
| 11 |
}; |
| 12 |
|
| 13 |
int C::foo() |
| 14 |
{ |
| 15 |
int arr1[40]; |
| 16 |
/* There is a parsing ambiguity here without the space. We don't try to |
| 17 |
resolve that automatically (though maybe we could, in theory). */ |
| 18 |
#pragma omp target map(arr1[::x: ::y]) |
| 19 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x>\] \[len: \(sizetype\) y \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 20 |
{ } |
| 21 |
#pragma omp target map(arr1[::x:]) |
| 22 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x>\] \[len: \(40 - \(sizetype\) SAVE_EXPR <x>\) \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 23 |
{ } |
| 24 |
#pragma omp target map(arr1[: ::y]) |
| 25 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[0\] \[len: \(sizetype\) y \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: 0\]\)} "original" } } |
| 26 |
{ } |
| 27 |
return ::x + ::y; |
| 28 |
} |
| 29 |
|
| 30 |
template<typename T> |
| 31 |
class Ct { |
| 32 |
T x, y; |
| 33 |
|
| 34 |
public: |
| 35 |
void foo(); |
| 36 |
}; |
| 37 |
|
| 38 |
template<typename T> |
| 39 |
void Ct<T>::foo() |
| 40 |
{ |
| 41 |
int arr1[40]; |
| 42 |
#pragma omp target map(arr1[::x: ::y]) |
| 43 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x>\] \[len: \(sizetype\) y \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 44 |
{ } |
| 45 |
#pragma omp target map(arr1[::x:]) |
| 46 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[SAVE_EXPR <x>\] \[len: \(40 - \(sizetype\) SAVE_EXPR <x>\) \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: \((?:long )?int\) &arr1\[SAVE_EXPR <x>\] - \((?:long )?int\) &arr1\]\)} "original" } } |
| 47 |
{ } |
| 48 |
#pragma omp target map(arr1[: ::y]) |
| 49 |
// { dg-final { scan-tree-dump {map\(tofrom:arr1\[0\] \[len: \(sizetype\) y \* [0-9]+\]\) map\(firstprivate:arr1 \[pointer assign, bias: 0\]\)} "original" } } |
| 50 |
{ } |
| 51 |
} |
| 52 |
|
| 53 |
int main() |
| 54 |
{ |
| 55 |
C c; |
| 56 |
Ct<int> ct; |
| 57 |
|
| 58 |
c.foo (); |
| 59 |
ct.foo (); |
| 60 |
|
| 61 |
return 0; |
| 62 |
} |
| 63 |
|