From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id D0BDA3861018; Tue, 8 Jun 2021 06:22:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0BDA3861018 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] openmp: Add testcase for scan directive with nested functions X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/devel/omp/gcc-11 X-Git-Oldrev: 90a3960d407d3a02ad7679d0bf58d8052e5d1feb X-Git-Newrev: e3433dd498e240ea4d642fb99594250eb78fd5fb Message-Id: <20210608062217.D0BDA3861018@sourceware.org> Date: Tue, 8 Jun 2021 06:22:17 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2021 06:22:17 -0000 https://gcc.gnu.org/g:e3433dd498e240ea4d642fb99594250eb78fd5fb commit e3433dd498e240ea4d642fb99594250eb78fd5fb Author: Jakub Jelinek Date: Tue Jun 8 08:22:02 2021 +0200 openmp: Add testcase for scan directive with nested functions > In convert_nonlocal_omp_clauses, the following clauses are > missing: OMP_CLAUSE_AFFINITY, OMP_CLAUSE_DEVICE_TYPE, > OMP_CLAUSE_EXCLUSIVE, OMP_CLAUSE_INCLUSIVE. OMP_CLAUSE_{EXCLUSIVE,INCLUSIVE} isn't needed, because we don't walk the clauses at all for GIMPLE_OMP_SCAN. It would be a bug if we used the exclusive/inclusive operands after gimplification, but we apparently don't do that, all we check is whether the OMP_CLAUSE_KIND of the first clause (all should be the same) is OMP_CLAUSE_EXCLUSIVE or OMP_CLAUSE_INCLUSIVE, nothing else. That said, I think we should have a testcase. 2021-06-06 Jakub Jelinek * gcc.dg/gomp/scan-1.c: New test. (cherry picked from commit cb4b99be48af1c0911ce2a957af20d9cd946f364) Diff: --- gcc/testsuite/ChangeLog.omp | 7 ++++++ gcc/testsuite/gcc.dg/gomp/scan-1.c | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 4ed55d768af..b7bf03ab9cb 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,10 @@ +2021-06-08 Tobias Burnus + + Backported from master: + 2021-06-06 Jakub Jelinek + + * gcc.dg/gomp/scan-1.c: New test. + 2021-06-04 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/gcc.dg/gomp/scan-1.c b/gcc/testsuite/gcc.dg/gomp/scan-1.c new file mode 100644 index 00000000000..807071d9156 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/scan-1.c @@ -0,0 +1,51 @@ +int baz (void); +void qux (int); +int r; + +int +foo (void) +{ + int r = 0, i; + void bar (void) { r++; } + #pragma omp parallel for reduction(inscan, +:r) + for (i = 0; i < 64; i++) + { + r += baz (); + #pragma omp scan inclusive(r) + qux (r); + } + #pragma omp parallel for reduction(inscan, +:r) + for (i = 0; i < 64; i++) + { + qux (r); + #pragma omp scan exclusive(r) + r += baz (); + } + bar (); + return r; +} + +int +corge (void) +{ + int r = 0, i; + void bar (void) + { + #pragma omp parallel for reduction(inscan, +:r) + for (i = 0; i < 64; i++) + { + r += baz (); + #pragma omp scan inclusive(r) + qux (r); + } + #pragma omp parallel for reduction(inscan, +:r) + for (i = 0; i < 64; i++) + { + qux (r); + #pragma omp scan exclusive(r) + r += baz (); + } + } + bar (); + return r; +}