mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 12:00:11 -05:00
OpenMP/OpenACC array sections, generally expr[expr:expr] or
expr[expr:expr:expr] can have any of the exprs between [ and ]
omitted, low-bound (first defaults to 0, last (stride) defaults to
1 and the middle (length) for some arrays defaults to
ceil((size − lower_bound)/stride).
People have been writing this for years without spaces between [ and :
and : and ] when that expr has been omitted, but guess for C++26
one needs to add a space. I think [ :: ] isn't going to be parsed
as the same as [ : : ] either.
gcc/testsuite/
* c-c++-common/goacc/cache-3-1.c: Add dg-skip-if for c++26.
* g++.dg/goacc/data-clause-2.C: Likewise.
* g++.dg/gomp/allocate-3.C: Likewise.
* c-c++-common/gomp/affinity-2.c: Use { c || c++23_down } effective
target.
* c-c++-common/goacc/cache-3-2.c: Replace [: in OpenMP or OpenACC
pragmas or attributes with [ : and :] with : ].
* c-c++-common/goacc/data-clause-1.c: Likewise.
* c-c++-common/goacc/data-clause-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/mdc-2.c: Likewise.
* c-c++-common/goacc/readonly-1.c: Likewise.
* c-c++-common/gomp/allocate-4.c: Likewise.
* c-c++-common/gomp/clauses-3.c: Likewise.
* c-c++-common/gomp/declare-mapper-3.c: Likewise.
* c-c++-common/gomp/depend-1.c: Likewise.
* c-c++-common/gomp/depend-2.c: Likewise.
* c-c++-common/gomp/depend-3.c: Likewise.
* c-c++-common/gomp/depend-4.c: Likewise.
* c-c++-common/gomp/depend-5.c: Likewise.
* c-c++-common/gomp/depend-6.c: Likewise.
* c-c++-common/gomp/dispatch-1.c: Likewise.
* c-c++-common/gomp/loop-5.c: Likewise.
* c-c++-common/gomp/map-1.c: Likewise.
* c-c++-common/gomp/map-2.c: Likewise.
* c-c++-common/gomp/map-4.c: Likewise.
* c-c++-common/gomp/map-7.c: Likewise.
* c-c++-common/gomp/pr100902-1.c: Likewise.
* c-c++-common/gomp/pr103642.c: Likewise.
* c-c++-common/gomp/pr120180-1.c: Likewise.
* c-c++-common/gomp/pr61486-1.c: Likewise.
* c-c++-common/gomp/pr81006.c: Likewise.
* c-c++-common/gomp/pr91920.c: Likewise.
* c-c++-common/gomp/pr96867.c: Likewise.
* c-c++-common/gomp/pr99928-16.c: Likewise.
* c-c++-common/gomp/reduction-1.c: Likewise.
* c-c++-common/gomp/scan-1.c: Likewise.
* c-c++-common/gomp/target-data-1.c: Likewise.
* c-c++-common/gomp/target-enter-data-1.c: Likewise.
* c-c++-common/gomp/target-has-device-addr-1.c: Likewise.
* c-c++-common/gomp/target-implicit-map-2.c: Likewise.
* c-c++-common/gomp/target-map-iterators-1.c: Likewise.
* c-c++-common/gomp/target-map-iterators-3.c: Likewise.
* c-c++-common/gomp/target-update-iterators-1.c: Likewise.
* c-c++-common/gomp/target-update-iterators-3.c: Likewise.
* g++.dg/goacc/cache-3-1.C: Likewise.
* g++.dg/goacc/cache-3-2.C: Likewise.
* g++.dg/goacc/data-clause-1.C: Likewise.
* g++.dg/goacc/mdc.C: Likewise.
* g++.dg/gomp/array-section-2.C: Likewise.
* g++.dg/gomp/bad-array-section-10.C: Likewise.
* g++.dg/gomp/bad-array-section-11.C: Likewise.
* g++.dg/gomp/bad-array-section-9.C: Likewise.
* g++.dg/gomp/declare-mapper-1.C: Likewise.
* g++.dg/gomp/declare-mapper-2.C: Likewise.
* g++.dg/gomp/depend-1.C: Likewise.
* g++.dg/gomp/depend-2.C: Likewise.
* g++.dg/gomp/ind-base-3.C: Likewise.
* g++.dg/gomp/map-1.C: Likewise.
* g++.dg/gomp/map-2.C: Likewise.
* g++.dg/gomp/map-ptrmem-1.C: Likewise.
* g++.dg/gomp/map-ptrmem-2.C: Likewise.
* g++.dg/gomp/member-array-2.C: Likewise.
* g++.dg/gomp/target-this-3.C: Likewise.
* g++.dg/gomp/target-this-4.C: Likewise.
libgomp/
* testsuite/libgomp.c++/allocate-1.C: Replace [: in OpenMP or OpenACC
pragmas or attributes with [ : and :] with : ].
* testsuite/libgomp.c++/baseptrs-3.C: Likewise.
* testsuite/libgomp.c++/baseptrs-5.C: Likewise.
* testsuite/libgomp.c++/class-array-1.C: Likewise.
* testsuite/libgomp.c++/examples-4/target_data-5.C: Likewise.
* testsuite/libgomp.c++/lvalue-tofrom-2.C: Likewise.
* testsuite/libgomp.c++/pr101544-1.C: Likewise.
* testsuite/libgomp.c++/pr108286.C: Likewise.
* testsuite/libgomp.c++/reduction-10.C: Likewise.
* testsuite/libgomp.c++/reduction-11.C: Likewise.
* testsuite/libgomp.c++/reduction-12.C: Likewise.
* testsuite/libgomp.c++/reduction-5.C: Likewise.
* testsuite/libgomp.c++/reduction-6.C: Likewise.
* testsuite/libgomp.c++/reduction-7.C: Likewise.
* testsuite/libgomp.c++/reduction-8.C: Likewise.
* testsuite/libgomp.c++/reduction-9.C: Likewise.
* testsuite/libgomp.c++/target-18.C: Likewise.
* testsuite/libgomp.c++/target-19.C: Likewise.
* testsuite/libgomp.c++/target-2.C: Likewise.
* testsuite/libgomp.c++/target-22.C: Likewise.
* testsuite/libgomp.c++/target-23.C: Likewise.
* testsuite/libgomp.c++/target-9.C: Likewise.
* testsuite/libgomp.c++/target-flex-100.C: Likewise.
* testsuite/libgomp.c++/target-flex-101.C: Likewise.
* testsuite/libgomp.c++/target-flex-12.C: Likewise.
* testsuite/libgomp.c++/target-flex-2003.C: Likewise.
* testsuite/libgomp.c++/target-flex-30.C: Likewise.
* testsuite/libgomp.c++/target-flex-300.C: Likewise.
* testsuite/libgomp.c++/target-flex-32.C: Likewise.
* testsuite/libgomp.c++/target-flex-33.C: Likewise.
* testsuite/libgomp.c++/target-flex-41.C: Likewise.
* testsuite/libgomp.c++/target-flex-60.C: Likewise.
* testsuite/libgomp.c++/target-flex-61.C: Likewise.
* testsuite/libgomp.c++/target-flex-62.C: Likewise.
* testsuite/libgomp.c++/target-flex-80.C: Likewise.
* testsuite/libgomp.c++/target-flex-81.C: Likewise.
* testsuite/libgomp.c++/target-has-device-addr-7.C: Likewise.
* testsuite/libgomp.c++/target-in-reduction-1.C: Likewise.
* testsuite/libgomp.c++/target-in-reduction-2.C: Likewise.
* testsuite/libgomp.c++/target-lambda-1.C: Likewise.
* testsuite/libgomp.c++/target-lambda-3.C: Likewise.
* testsuite/libgomp.c++/target-map-class-1.C: Likewise.
* testsuite/libgomp.c++/target-std__array-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__flat_set-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__forward_list-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__map-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__set-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__valarray-1.C: Likewise.
* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.
* testsuite/libgomp.c++/target-this-3.C: Likewise.
* testsuite/libgomp.c++/target-this-4.C: Likewise.
* testsuite/libgomp.c++/target-virtual-1.C: Likewise.
* testsuite/libgomp.c++/task-reduction-11.C: Likewise.
* testsuite/libgomp.c++/task-reduction-12.C: Likewise.
* testsuite/libgomp.c++/task-reduction-13.C: Likewise.
* testsuite/libgomp.c++/task-reduction-17.C: Likewise.
* testsuite/libgomp.c++/task-reduction-18.C: Likewise.
* testsuite/libgomp.c++/task-reduction-19.C: Likewise.
* testsuite/libgomp.c++/task-reduction-4.C: Likewise.
* testsuite/libgomp.c++/task-reduction-5.C: Likewise.
* testsuite/libgomp.c++/task-reduction-6.C: Likewise.
* testsuite/libgomp.c++/task-reduction-7.C: Likewise.
* testsuite/libgomp.c++/taskloop-reduction-2.C: Likewise.
* testsuite/libgomp.c++/taskloop-reduction-3.C: Likewise.
* testsuite/libgomp.c++/taskloop-reduction-4.C: Likewise.
* testsuite/libgomp.c-c++-common/allocate-1.c: Likewise.
* testsuite/libgomp.c-c++-common/allocate-3.c: Likewise.
* testsuite/libgomp.c-c++-common/baseptrs-2.c: Likewise.
* testsuite/libgomp.c-c++-common/dispatch-1.c: Likewise.
* testsuite/libgomp.c-c++-common/dispatch-2.c: Likewise.
* testsuite/libgomp.c-c++-common/interop-2.c: Likewise.
* testsuite/libgomp.c-c++-common/matrix-omp-target-teams-distribute-parallel-for-1.c:
Likewise.
* testsuite/libgomp.c-c++-common/ptr-attach-1.c: Likewise.
* testsuite/libgomp.c-c++-common/ptr-attach-2.c: Likewise.
* testsuite/libgomp.c-c++-common/refcount-1.c: Likewise.
* testsuite/libgomp.c-c++-common/struct-elem-4.c: Likewise.
* testsuite/libgomp.c-c++-common/target-2.c: Likewise.
* testsuite/libgomp.c-c++-common/target-has-device-addr-1.c: Likewise.
* testsuite/libgomp.c-c++-common/target-implicit-map-2.c: Likewise.
* testsuite/libgomp.c-c++-common/target-implicit-map-5.c: Likewise.
* testsuite/libgomp.c-c++-common/target-in-reduction-1.c: Likewise.
* testsuite/libgomp.c-c++-common/target-in-reduction-2.c: Likewise.
* testsuite/libgomp.c-c++-common/target-map-iterators-1.c: Likewise.
* testsuite/libgomp.c-c++-common/target-map-iterators-2.c: Likewise.
* testsuite/libgomp.c-c++-common/target-map-iterators-3.c: Likewise.
* testsuite/libgomp.c-c++-common/target-map-zlas-1.c: Likewise.
* testsuite/libgomp.c-c++-common/target-update-iterators-1.c: Likewise.
* testsuite/libgomp.c-c++-common/target-update-iterators-2.c: Likewise.
* testsuite/libgomp.c-c++-common/target-update-iterators-3.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-11.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-12.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-16.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-3.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-7.c: Likewise.
* testsuite/libgomp.c-c++-common/task-reduction-9.c: Likewise.
* testsuite/libgomp.c-c++-common/taskloop-reduction-2.c: Likewise.
* testsuite/libgomp.c-c++-common/teams-nteams-icv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Likewise.
213 lines
5.0 KiB
C
213 lines
5.0 KiB
C
#ifdef __cplusplus
|
|
extern "C"
|
|
#endif
|
|
void abort (void);
|
|
|
|
int a[2];
|
|
long long int b[7] = { 9, 11, 1, 1, 1, 13, 15 };
|
|
int e[3] = { 5, 0, 5 };
|
|
int f[5] = { 6, 7, 0, 0, 9 };
|
|
int g[4] = { 1, 0, 0, 2 };
|
|
int h[3] = { 0, 1, 4 };
|
|
int k[4][2] = { { 5, 6 }, { 0, 0 }, { 0, 0 }, { 7, 8 } };
|
|
long long *s;
|
|
long long (*t)[2];
|
|
|
|
void
|
|
foo (int n, int *c, long long int *d, int m[3], int *r, int o[4], int *p, int q[4][2])
|
|
{
|
|
int i;
|
|
#pragma omp taskloop in_reduction (+: a, c[ :2]) in_reduction (*: b[2 * n:3 * n], d[0:2]) \
|
|
in_reduction (+: o[n:n*2], m[1], k[1:2][ : ], p[0], f[2:2]) \
|
|
in_reduction (+: q[1:2][ : ], g[n:n*2], e[1], h[0], r[2:2]) \
|
|
in_reduction (*: s[1:2], t[2:2][ : ]) nogroup
|
|
for (i = 0; i < 2; i++)
|
|
{
|
|
a[0] += 7;
|
|
a[1] += 17;
|
|
b[2] *= 2;
|
|
b[4] *= 2;
|
|
c[0] += 6;
|
|
d[1] *= 2;
|
|
e[1] += 19;
|
|
f[2] += 21;
|
|
f[3] += 23;
|
|
g[1] += 25;
|
|
g[2] += 27;
|
|
h[0] += 29;
|
|
k[1][0] += 31;
|
|
k[2][1] += 33;
|
|
m[1] += 19;
|
|
r[2] += 21;
|
|
r[3] += 23;
|
|
o[1] += 25;
|
|
o[2] += 27;
|
|
p[0] += 29;
|
|
q[1][0] += 31;
|
|
q[2][1] += 33;
|
|
s[1] *= 2;
|
|
t[2][0] *= 2;
|
|
t[3][1] *= 2;
|
|
}
|
|
}
|
|
|
|
void
|
|
test (int n)
|
|
{
|
|
int c[2] = { 0, 0 };
|
|
int p[3] = { 0, 1, 4 };
|
|
int q[4][2] = { { 5, 6 }, { 0, 0 }, { 0, 0 }, { 7, 8 } };
|
|
long long ss[4] = { 5, 1, 1, 6 };
|
|
long long tt[5][2] = { { 9, 10 }, { 11, 12 }, { 1, 1 }, { 1, 1 }, { 13, 14 } };
|
|
s = ss;
|
|
t = tt;
|
|
#pragma omp parallel
|
|
#pragma omp single
|
|
{
|
|
long long int d[] = { 1, 1 };
|
|
int m[3] = { 5, 0, 5 };
|
|
int r[5] = { 6, 7, 0, 0, 9 };
|
|
int o[4] = { 1, 0, 0, 2 };
|
|
int i;
|
|
#pragma omp taskloop reduction (+: a, c) reduction (default, *: b[2 * n:3 * n], d) \
|
|
reduction (+: e[1], f[2:2], g[n:n*2], h[0], k[1:2][0:2]) \
|
|
reduction (default, +: o[n:n*2], m[1], q[1:2][ : ], p[0], r[2:2]) \
|
|
reduction (*: t[2:2][ : ], s[1:n + 1])
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
int j;
|
|
a[0] += 2;
|
|
a[1] += 3;
|
|
b[2] *= 2;
|
|
f[3] += 8;
|
|
g[1] += 9;
|
|
g[2] += 10;
|
|
h[0] += 11;
|
|
k[1][1] += 13;
|
|
k[2][1] += 15;
|
|
m[1] += 16;
|
|
r[2] += 8;
|
|
s[1] *= 2;
|
|
t[2][1] *= 2;
|
|
t[3][1] *= 2;
|
|
#pragma omp taskloop in_reduction (+: a, c[ :2]) \
|
|
in_reduction (*: b[2 * n:3 * n], d[n - 1:n + 1]) \
|
|
in_reduction (+: e[1], f[2:2], g[n:n*2], h[0], k[1:2][ :2]) \
|
|
in_reduction (+: m[1], r[2:2], o[n:n*2], p[0], q[1:2][ :2]) \
|
|
in_reduction (*: s[n:2], t[2:2][ : ]) nogroup
|
|
for (j = 0; j < 2; j++)
|
|
{
|
|
m[1] += 6;
|
|
r[2] += 7;
|
|
q[1][0] += 17;
|
|
q[2][0] += 19;
|
|
a[0] += 4;
|
|
a[1] += 5;
|
|
b[3] *= 2;
|
|
b[4] *= 2;
|
|
f[3] += 18;
|
|
g[1] += 29;
|
|
g[2] += 18;
|
|
h[0] += 19;
|
|
s[2] *= 2;
|
|
t[2][0] *= 2;
|
|
t[3][0] *= 2;
|
|
foo (n, c, d, m, r, o, p, q);
|
|
r[3] += 18;
|
|
o[1] += 29;
|
|
o[2] += 18;
|
|
p[0] += 19;
|
|
c[0] += 4;
|
|
c[1] += 5;
|
|
d[0] *= 2;
|
|
e[1] += 6;
|
|
f[2] += 7;
|
|
k[1][0] += 17;
|
|
k[2][0] += 19;
|
|
}
|
|
r[3] += 8;
|
|
o[1] += 9;
|
|
o[2] += 10;
|
|
p[0] += 11;
|
|
q[1][1] += 13;
|
|
q[2][1] += 15;
|
|
b[3] *= 2;
|
|
c[0] += 4;
|
|
c[1] += 9;
|
|
d[0] *= 2;
|
|
e[1] += 16;
|
|
f[2] += 8;
|
|
}
|
|
if (d[0] != 1LL << (8 + 4)
|
|
|| d[1] != 1LL << 16
|
|
|| m[0] != 5
|
|
|| m[1] != 19 * 16 + 6 * 8 + 16 * 4
|
|
|| m[2] != 5
|
|
|| r[0] != 6
|
|
|| r[1] != 7
|
|
|| r[2] != 21 * 16 + 7 * 8 + 8 * 4
|
|
|| r[3] != 23 * 16 + 18 * 8 + 8 * 4
|
|
|| r[4] != 9
|
|
|| o[0] != 1
|
|
|| o[1] != 25 * 16 + 29 * 8 + 9 * 4
|
|
|| o[2] != 27 * 16 + 18 * 8 + 10 * 4
|
|
|| o[3] != 2)
|
|
abort ();
|
|
}
|
|
if (a[0] != 7 * 16 + 4 * 8 + 2 * 4
|
|
|| a[1] != 17 * 16 + 5 * 8 + 3 * 4
|
|
|| b[0] != 9 || b[1] != 11
|
|
|| b[2] != 1LL << (16 + 4)
|
|
|| b[3] != 1LL << (8 + 4)
|
|
|| b[4] != 1LL << (16 + 8)
|
|
|| b[5] != 13 || b[6] != 15
|
|
|| c[0] != 6 * 16 + 4 * 8 + 4 * 4
|
|
|| c[1] != 5 * 8 + 9 * 4
|
|
|| e[0] != 5
|
|
|| e[1] != 19 * 16 + 6 * 8 + 16 * 4
|
|
|| e[2] != 5
|
|
|| f[0] != 6
|
|
|| f[1] != 7
|
|
|| f[2] != 21 * 16 + 7 * 8 + 8 * 4
|
|
|| f[3] != 23 * 16 + 18 * 8 + 8 * 4
|
|
|| f[4] != 9
|
|
|| g[0] != 1
|
|
|| g[1] != 25 * 16 + 29 * 8 + 9 * 4
|
|
|| g[2] != 27 * 16 + 18 * 8 + 10 * 4
|
|
|| g[3] != 2
|
|
|| h[0] != 29 * 16 + 19 * 8 + 11 * 4
|
|
|| h[1] != 1 || h[2] != 4
|
|
|| k[0][0] != 5 || k[0][1] != 6
|
|
|| k[1][0] != 31 * 16 + 17 * 8
|
|
|| k[1][1] != 13 * 4
|
|
|| k[2][0] != 19 * 8
|
|
|| k[2][1] != 33 * 16 + 15 * 4
|
|
|| k[3][0] != 7 || k[3][1] != 8
|
|
|| p[0] != 29 * 16 + 19 * 8 + 11 * 4
|
|
|| p[1] != 1 || p[2] != 4
|
|
|| q[0][0] != 5 || q[0][1] != 6
|
|
|| q[1][0] != 31 * 16 + 17 * 8
|
|
|| q[1][1] != 13 * 4
|
|
|| q[2][0] != 19 * 8
|
|
|| q[2][1] != 33 * 16 + 15 * 4
|
|
|| q[3][0] != 7 || q[3][1] != 8
|
|
|| ss[0] != 5
|
|
|| ss[1] != 1LL << (16 + 4)
|
|
|| ss[2] != 1LL << 8
|
|
|| ss[3] != 6
|
|
|| tt[0][0] != 9 || tt[0][1] != 10 || tt[1][0] != 11 || tt[1][1] != 12
|
|
|| tt[2][0] != 1LL << (16 + 8)
|
|
|| tt[2][1] != 1LL << 4
|
|
|| tt[3][0] != 1LL << 8
|
|
|| tt[3][1] != 1LL << (16 + 4)
|
|
|| tt[4][0] != 13 || tt[4][1] != 14)
|
|
abort ();
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
test (1);
|
|
return 0;
|
|
}
|