From cb3f06480a17f98579704b9927632627a3814c5c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 6 Feb 2020 09:19:08 +0100 Subject: openmp: Fix handling of non-addressable shared scalars in parallel nested inside of target [PR93515] As the following testcase shows, we need to consider even target to be a construct that forces not to use copy in/out for shared on parallel inside of the target. E.g. for parallel nested inside another parallel or host teams, we already avoid copy in/out and we need to treat target the same. 2020-02-06 Jakub Jelinek PR libgomp/93515 * omp-low.c (use_pointer_for_field): For nested constructs, also look for map clauses on target construct. (scan_omp_1_stmt) : Bump temporarily taskreg_nesting_level. * testsuite/libgomp.c-c++-common/pr93515.c: New test. --- libgomp/ChangeLog | 5 ++++ libgomp/testsuite/libgomp.c-c++-common/pr93515.c | 36 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 libgomp/testsuite/libgomp.c-c++-common/pr93515.c (limited to 'libgomp') diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 56e9da7..ba14005 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2020-02-06 Jakub Jelinek + + PR libgomp/93515 + * testsuite/libgomp.c-c++-common/pr93515.c: New test. + 2020-02-05 Tobias Burnus * testsuite/lib/libgomp.exp diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr93515.c b/libgomp/testsuite/libgomp.c-c++-common/pr93515.c new file mode 100644 index 0000000..8a69088 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr93515.c @@ -0,0 +1,36 @@ +/* PR libgomp/93515 */ + +#include +#include + +int +main () +{ + int i; + int a = 42; +#pragma omp target teams distribute parallel for defaultmap(tofrom: scalar) + for (i = 0; i < 64; ++i) + if (omp_get_team_num () == 0) + if (omp_get_thread_num () == 0) + a = 142; + if (a != 142) + __builtin_abort (); + a = 42; +#pragma omp target parallel for defaultmap(tofrom: scalar) + for (i = 0; i < 64; ++i) + if (omp_get_thread_num () == 0) + a = 143; + if (a != 143) + __builtin_abort (); + a = 42; +#pragma omp target firstprivate(a) + { + #pragma omp parallel for + for (i = 0; i < 64; ++i) + if (omp_get_thread_num () == 0) + a = 144; + if (a != 144) + abort (); + } + return 0; +} -- cgit v1.1