diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-05-26 10:14:37 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-05-26 10:14:37 +0000 |
commit | 4ee1ccec427fa6a01a347bf948f8e1822af43426 (patch) | |
tree | 7e0b98c6e70a74d54deb99f180349d7a6e0bc6e2 /libgomp | |
parent | 79c188a5d3679be8272e1cf96fbfbaf4550f3b56 (diff) |
Backported from mainline
2017-05-22 Jakub Jelinek <jakub@redhat.com>
PR middle-end/80809
* omp-low.c (finish_taskreg_remap): New function.
(finish_taskreg_scan): If unit size of ctx->record_type
is non-constant, unshare the size expression and replace
decls in it with possible outer var refs.
* testsuite/libgomp.c/pr80809-2.c: New test.
* testsuite/libgomp.c/pr80809-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@248488 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr80809-2.c | 35 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr80809-3.c | 42 |
3 files changed, 82 insertions, 1 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 9a2d4e5a43e4..b103098ea50d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -2,7 +2,11 @@ Backported from mainline 2017-05-22 Jakub Jelinek <jakub@redhat.com> - + + PR middle-end/80809 + * testsuite/libgomp.c/pr80809-2.c: New test. + * testsuite/libgomp.c/pr80809-3.c: New test. + PR middle-end/80809 * testsuite/libgomp.c/pr80809-1.c: New test. diff --git a/libgomp/testsuite/libgomp.c/pr80809-2.c b/libgomp/testsuite/libgomp.c/pr80809-2.c new file mode 100644 index 000000000000..48af37077949 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr80809-2.c @@ -0,0 +1,35 @@ +/* PR middle-end/80809 */ +/* { dg-do run } */ + +__attribute__((noinline, noclone)) void +foo (int x) +{ + int i, v[x], w[16]; + for (i = 0; i < x; i++) + v[i] = i; + for (i = 0; i < 16; i++) + w[i] = 0; +#pragma omp parallel +#pragma omp single + for (i = 0; i < 16; i++) +#pragma omp task firstprivate (v) + { + int j; + for (j = 0; j < x; j++) + v[j] += i; + for (j = 0; j < x; j++) + w[i] += v[j]; + } + for (i = 0; i < 16; i++) + if (w[i] != (x - 1) * x / 2 + x * i) + __builtin_abort (); +} + +int +main () +{ + foo (4); + foo (27); + foo (196); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr80809-3.c b/libgomp/testsuite/libgomp.c/pr80809-3.c new file mode 100644 index 000000000000..7e0d17983e4d --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr80809-3.c @@ -0,0 +1,42 @@ +/* PR middle-end/80809 */ +/* { dg-do run } */ + +__attribute__((noinline, noclone)) void +foo (int x) +{ + int i, v[x], w[16]; + for (i = 0; i < x; i++) + v[i] = i; + for (i = 0; i < 16; i++) + w[i] = 0; +#pragma omp parallel +#pragma omp single + { + int z[x]; + for (i = 0; i < x; i++) + z[0] = 0; + for (i = 0; i < 16; i++) +#pragma omp task firstprivate (z) firstprivate (v) + { + int j; + for (j = 0; j < x; j++) + z[j] = i; + for (j = 0; j < x; j++) + v[j] += z[j]; + for (j = 0; j < x; j++) + w[i] += v[j]; + } + } + for (i = 0; i < 16; i++) + if (w[i] != (x - 1) * x / 2 + x * i) + __builtin_abort (); +} + +int +main () +{ + foo (4); + foo (27); + foo (196); + return 0; +} |