diff options
author | Rong Xu <xur@google.com> | 2014-07-21 16:47:22 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-07-29 15:31:03 -0700 |
commit | 38a8aecfb882072900434499696b5c32a2274515 (patch) | |
tree | 2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/testsuite/c-c++-common | |
parent | c231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff) | |
download | toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2 toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip |
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch.
We also cherry-picked r213062, r213063 and r213064 to fix windows
build issues.
All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9.
The following prior commits has not been merged to google branch yet.
(They are included in this commit).
e7af147f979e657fe2df00808e5b4319b0e088c6,
baf87df3cb2683649ba7e9872362a7e721117c23, and
c231900e5dcc14d8296bd9f62b45997a49d4d5e7.
Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common')
12 files changed, 665 insertions, 2 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c new file mode 100644 index 000000000..83325a775 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c @@ -0,0 +1,15 @@ +/* PR middle-end/57541 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int foo1 () +{ + int a; + a = __sec_reduce_add (1); /* { dg-error "Invalid builtin arguments" } */ +} + +int foo2 () +{ + int a; + a = __sec_reduce_add (); /* { dg-error "Invalid builtin arguments" } */ +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c index 9bff07991..f379e461c 100755 --- a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c @@ -1,9 +1,10 @@ +/* PR middle-end/57541 */ /* { dg-do compile } */ /* { dg-options "-fcilkplus" } */ int A[10]; -int main () { +int foo () { /* C compiler uses the term "undeclared" whereas C++ compiler uses "not declared". Thus, grepping for declared seem to be the easiest. */ @@ -13,5 +14,13 @@ int main () { A[l:s:c]; } -/* { dg-message "note: each" "defined" { target c } 10 } */ +int foo1 (int N) { + + char c = (char)N; + short s = (short)N; + A[l:s:c]; /* { dg-error "declared" } */ +} + + +/* { dg-message "note: each" "defined" { target c } 11 } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c new file mode 100644 index 000000000..87903af3c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c @@ -0,0 +1,8 @@ +/* PR c/58942 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int foo (int*p, int i) +{ + return __sec_reduce_max_ind(p[1:i]); +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c new file mode 100644 index 000000000..deb839218 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c @@ -0,0 +1,10 @@ +/* PR c/61191 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +double f(double * A, double * B) +{ + return __sec_reduce_add((B[0:500])(; /* { dg-error "called object" "" { target c } } */ +/* { dg-error "expected expression before ';' token" "" { target c } 7 } */ +/* { dg-error "expected primary-expression before ';' token" "" { target c++ } 7 } */ +} /* { dg-error "expected" "" { target c } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc new file mode 100644 index 000000000..cf1caf12b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc @@ -0,0 +1,9 @@ +/* PR c/60189 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int main (void) +{ + _Cilk_sync return; /* { dg-error " expected ';' before 'return'" } */ + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59073.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59073.c new file mode 100644 index 000000000..543ff5d34 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59073.c @@ -0,0 +1,12 @@ +/* PR c/59073 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo () +{ + int i; +#pragma omp distribute parallel for + for (i = 0; i < 10; i) /* { dg-error "invalid increment expression" } */ + ; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-1.c new file mode 100644 index 000000000..5f985724d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-1.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/60823 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd" } */ + +#pragma omp declare simd simdlen(4) notinbranch +int +foo (const double c1, const double c2) +{ + double z1 = c1, z2 = c2; + int res = 100, i; + + for (i = 0; i < 100; i++) + { + res = (z1 * z1 + z2 * z2 > 4.0) ? (i < res ? i : res) : res; + z1 = c1 + z1 * z1 - z2 * z2; + z2 = c2 + 2.0 * z1 * z2; + } + return res; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-2.c new file mode 100644 index 000000000..4c8762007 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-2.c @@ -0,0 +1,44 @@ +/* PR tree-optimization/60823 */ +/* { dg-do run } */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-options "-O2 -fopenmp-simd" } */ + +#pragma omp declare simd simdlen(4) notinbranch +__attribute__((noinline)) int +foo (double c1, double c2) +{ + double z1 = c1, z2 = c2; + int res = 100, i; + + for (i = 0; i < 5; i++) + { + res = (z1 * z1 + z2 * z2 > 4.0) ? (i < res ? i : res) : res; + z1 = c1 + z1 * z1 - z2 * z2; + z2 = c2 + 2.0 * z1 * z2; + c1 += 0.5; + c2 += 0.5; + } + return res; +} + +__attribute__((noinline, noclone)) void +bar (double *x, double *y) +{ + asm volatile ("" : : "rm" (x), "rm" (y) : "memory"); +} + +int +main () +{ + int i; + double c[4] = { 0.0, 1.0, 0.0, 1.0 }; + double d[4] = { 0.0, 1.0, 2.0, 0.0 }; + int e[4]; + bar (c, d); +#pragma omp simd safelen(4) + for (i = 0; i < 4; i++) + e[i] = foo (c[i], d[i]); + if (e[0] != 3 || e[1] != 1 || e[2] != 1 || e[3] != 2) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-3.c new file mode 100644 index 000000000..93e9fbe3a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-3.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/60823 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd -fno-strict-aliasing" } */ + +void bar (char *, double *); + +#if __SIZEOF_DOUBLE__ >= 4 + +struct S { char c[sizeof (double)]; }; +void baz (struct S, struct S); +union U { struct S s; double d; }; + +#pragma omp declare simd simdlen(4) notinbranch +__attribute__((noinline)) int +foo (double c1, double c2) +{ + double *a = &c1; + char *b = (char *) &c1 + 2; + + b[-2]++; + b[1]--; + *a++; + c2++; + bar ((char *) &c2 + 1, &c2); + c2 *= 3.0; + bar (b, a); + baz (((union U) { .d = c1 }).s, ((union U) { .d = c2 }).s); + baz (*(struct S *)&c1, *(struct S *)&c2); + return c1 + c2 + ((struct S *)&c1)->c[1]; +} + +#endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-1.c new file mode 100644 index 000000000..9ada58c8c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-1.c @@ -0,0 +1,13 @@ +/* PR middle-end/61486 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +foo (int *a) +{ + int i, j = 0; + #pragma omp target teams distribute simd linear(i, j) map(a[:10]) + for (i = 0; i < 10; i++) + a[i] = j++; + return i + j; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-2.c new file mode 100644 index 000000000..729438101 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61486-2.c @@ -0,0 +1,458 @@ +/* PR middle-end/61486 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +#pragma omp declare target +void dosomething (int *a, int n, int m); +#pragma omp end declare target + +void +test (int n, int o, int p, int q, int r, int s, int *pp) +{ + int a[o], i, j; + #pragma omp target data device (n + 1) if (n != 6) map (tofrom: n, r) + { + #pragma omp target device (n + 1) if (n != 6) map (from: n) map (alloc: a[2:o-2]) + dosomething (a, n, 0); + #pragma omp target teams device (n + 1) num_teams (n + 4) thread_limit (n * 2) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target teams distribute device (n + 1) num_teams (n + 4) collapse (2) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target teams distribute device (n + 1) num_teams (n + 4) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target teams distribute parallel for device (n + 1) num_teams (n + 4) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + ordered schedule (static, 8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + #pragma omp ordered + p = q; + s = i * 10 + j; + } + #pragma omp target teams distribute parallel for device (n + 1) num_teams (n + 4) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \ + proc_bind (master) lastprivate (s) ordered schedule (static, 8) + for (i = 0; i < 10; i++) + { + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp ordered + p = q; + s = i * 10; + } + #pragma omp target teams distribute parallel for simd device (n + 1) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + schedule (static, 8) num_teams (n + 4) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target teams distribute parallel for simd device (n + 1) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \ + proc_bind (master) lastprivate (s) schedule (static, 8) \ + num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp target teams distribute simd device (n + 1) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + lastprivate (s) num_teams (n + 4) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target teams distribute simd device (n + 1) \ + if (n != 6)map (from: n) map (alloc: a[2:o-2]) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) lastprivate (s) \ + num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams num_teams (n + 4) thread_limit (n * 2) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute num_teams (n + 4) collapse (2) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute num_teams (n + 4) default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute parallel for num_teams (n + 4) if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + ordered schedule (static, 8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + #pragma omp ordered + p = q; + s = i * 10 + j; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute parallel for num_teams (n + 4) if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \ + proc_bind (master) lastprivate (s) ordered schedule (static, 8) + for (i = 0; i < 10; i++) + { + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp ordered + p = q; + s = i * 10; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + schedule (static, 8) num_teams (n + 4) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) num_threads (n + 4) \ + proc_bind (master) lastprivate (s) schedule (static, 8) \ + num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute simd default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) collapse (2) \ + lastprivate (s) num_teams (n + 4) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) + #pragma omp teams distribute simd default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + thread_limit (n * 2) dist_schedule (static, 4) lastprivate (s) \ + num_teams (n + 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2)default(shared) shared(n) \ + private (p) reduction (+: r) + #pragma omp distribute collapse (2) dist_schedule (static, 4) firstprivate (q) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) shared(n) private(p) reduction (+ : r) \ + default(shared) + #pragma omp distribute dist_schedule (static, 4) firstprivate (q) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) + #pragma omp distribute parallel for if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + ordered schedule (static, 8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + #pragma omp ordered + p = q; + s = i * 10 + j; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) + #pragma omp distribute parallel for if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + num_threads (n + 4) dist_schedule (static, 4) \ + proc_bind (master) lastprivate (s) ordered schedule (static, 8) + for (i = 0; i < 10; i++) + { + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp ordered + p = q; + s = i * 10; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) + #pragma omp distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + schedule (static, 8) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) + #pragma omp distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + num_threads (n + 4) dist_schedule (static, 4) \ + proc_bind (master) lastprivate (s) schedule (static, 8) \ + safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) default(shared) shared(n) private(p) \ + reduction(+:r) + #pragma omp distribute simd private (p) firstprivate (q) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) lastprivate (s) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp target teams device (n + 1) if (n != 6)map(from:n) map(alloc:a[2:o-2]) \ + num_teams (n + 4) thread_limit (n * 2) default(shared) shared(n) private(p) \ + reduction(+:r) + #pragma omp distribute simd private (p) firstprivate (q) reduction (+: r) \ + lastprivate (s) dist_schedule (static, 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + } +} + +int q, i, j; + +void +test2 (int n, int o, int p, int r, int s, int *pp) +{ + int a[o]; + #pragma omp distribute collapse (2) dist_schedule (static, 4) firstprivate (q) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp distribute dist_schedule (static, 4) firstprivate (q) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp distribute parallel for if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + ordered schedule (static, 8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + #pragma omp ordered + p = q; + s = i * 10 + j; + } + #pragma omp distribute parallel for if (n != 6) \ + default(shared) private (p) firstprivate (q) shared (n) reduction (+: r) \ + num_threads (n + 4) dist_schedule (static, 4) \ + proc_bind (master) lastprivate (s) ordered schedule (static, 8) + for (i = 0; i < 10; i++) + { + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + dosomething (a, n, p + q); + } + #pragma omp ordered + p = q; + s = i * 10; + } + #pragma omp distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) \ + num_threads (n + 4) proc_bind (spread) lastprivate (s) \ + schedule (static, 8) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp distribute parallel for simd if (n != 6)default(shared) \ + private (p) firstprivate (q) shared (n) reduction (+: r) \ + num_threads (n + 4) dist_schedule (static, 4) \ + proc_bind (master) lastprivate (s) schedule (static, 8) \ + safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } + #pragma omp distribute simd private (p) firstprivate (q) reduction (+: r) \ + collapse (2) dist_schedule (static, 4) lastprivate (s) safelen(8) + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + { + r = r + 1; + p = q; + a[2+i*10+j] = p + q; + s = i * 10 + j; + } + #pragma omp distribute simd private (p) firstprivate (q) reduction (+: r) \ + lastprivate (s) dist_schedule (static, 4) safelen(16) linear(i:1) aligned (pp:4) + for (i = 0; i < 10; i++) + { + r = r + 1; + p = q; + a[2+i] = p + q; + s = i * 10; + } +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60971.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60971.c new file mode 100644 index 000000000..b7a967dab --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60971.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/60971 */ +/* { dg-do run } */ + +#ifndef __cplusplus +#define bool _Bool +#endif + +volatile unsigned char c; + +__attribute__((noinline)) unsigned char +foo (void) +{ + return c; +} + +__attribute__((noinline)) bool +bar (void) +{ + return foo () & 1; +} + +int +main () +{ + c = 0x41; + c = bar (); + if (c != 1) + __builtin_abort (); + c = 0x20; + c = bar (); + if (c != 0) + __builtin_abort (); + return 0; +} |