From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Frederik Harwath <frederik@codesourcery.com>,
Tobias Burnus <tobias@codesourcery.com>
Subject: Re: [PATCH 0/2] Add tests to verify OpenACC clause locations
Date: Tue, 3 Nov 2020 22:34:33 +0100 [thread overview]
Message-ID: <87y2jidt06.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <87ft5qg8gi.fsf@euler.schwinge.homeip.net>
[-- Attachment #1: Type: text/plain, Size: 966 bytes --]
Hi!
On 2020-11-03T09:17:49+0100, I wrote:
> I've just pushed "[OpenACC] More precise diagnostics for 'gang',
> 'worker', 'vector' clauses with arguments on 'loop' only allowed in
> 'kernels' regions" to master branch in commit
> beddd1762ad2bbe84dd776c54489153f83f21e56, and backported to
> releases/gcc-10 in commit 8d09f49006ce4c2f8d4018206c12e131c49ca6ce
> [...], and 'inform' at the location of the enclosing parent
> compute construct/[...].
Now really. I've pushed "[OpenACC] Use proper location to 'inform' of
enclosing parent compute construct" to master branch in commit
fab72592d86d11b89a01f0f3c2c9c329d43466c1, and backported to
releases/gcc-10 branch in commit
a32d089dcf3edaa625e4871e78150b7d297cda5b, see attached.
Grüße
Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-OpenACC-Use-proper-location-to-inform-of-enclosing-p.patch --]
[-- Type: text/x-diff, Size: 7654 bytes --]
From fab72592d86d11b89a01f0f3c2c9c329d43466c1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 3 Nov 2020 22:06:29 +0100
Subject: [PATCH] [OpenACC] Use proper location to 'inform' of enclosing parent
compute construct
Bug fix for recent commit beddd1762ad2bbe84dd776c54489153f83f21e56 "[OpenACC]
More precise diagnostics for 'gang', 'worker', 'vector' clauses with arguments
on 'loop' only allowed in 'kernels' regions":
> [...], and 'inform' at the location of the enclosing parent
> compute construct/[...].
Now really.
gcc/
* omp-low.c (scan_omp_for) <OpenACC>: Use proper location to
'inform' of enclosing parent compute construct.
gcc/testsuite/
* c-c++-common/goacc/pr92793-1.c: Extend.
* gfortran.dg/goacc/pr92793-1.f90: Likewise.
---
gcc/omp-low.c | 2 +-
gcc/testsuite/c-c++-common/goacc/pr92793-1.c | 58 +++++++++++++++++--
gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 | 55 ++++++++++++++++--
3 files changed, 104 insertions(+), 11 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2f1a544bd46e..ea9008b61c41 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2443,7 +2443,7 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx)
"argument not permitted on %qs clause",
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
if (tgt)
- inform (gimple_location (outer_ctx->stmt),
+ inform (gimple_location (tgt->stmt),
"enclosing parent compute construct");
else if (oacc_get_fn_attrib (current_function_decl))
inform (DECL_SOURCE_LOCATION (current_function_decl),
diff --git a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
index 77ebb20265cf..71a556e27513 100644
--- a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
@@ -57,7 +57,7 @@ reduction(-:sum ) /* { dg-line sum2 } */ \
void
-a_sl() {
+gwv_sl_1() {
#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */ \
gang(num:5) /* { dg-error "5: argument not permitted on 'gang' clause" } */ \
worker(num:5) /* { dg-error "3: argument not permitted on 'worker' clause" } */ \
@@ -67,7 +67,25 @@ a_sl() {
}
void
-a_s_l() {
+gwv_sl_2() {
+#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "9: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
+}
+
+void
+gwv_s_l() {
#pragma acc serial /* { dg-message "9: enclosing parent compute construct" } */
{
#pragma acc loop \
@@ -76,18 +94,48 @@ a_s_l() {
vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
for (int i = 0; i < 10; i++)
;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "10: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "7: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "5: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
}
}
-void a_r();
-#pragma acc routine(a_r)
+void gwv_r();
+#pragma acc routine(gwv_r)
void
-a_r() { /* { dg-message "1: enclosing routine" } */
+gwv_r() { /* { dg-message "1: enclosing routine" } */
#pragma acc loop \
gang(num:5) /* { dg-error "4: argument not permitted on 'gang' clause" } */ \
worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
for (int i = 0; i < 10; i++)
;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "6: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "6: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
}
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
index 4651ccffaa1f..422131ba4734 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
@@ -47,7 +47,7 @@ subroutine check ()
end subroutine check
-subroutine gwv_sl ()
+subroutine gwv_sl_1 ()
implicit none (type, external)
integer :: i
@@ -59,11 +59,30 @@ subroutine gwv_sl ()
do i = 0, 10
end do
!$acc end serial loop
-end subroutine gwv_sl
+end subroutine gwv_sl_1
+
+subroutine gwv_sl_2 ()
+ implicit none (type, external)
+ integer :: i, j, k
+
+ !$acc serial loop ! { dg-message "77: enclosing parent compute construct" }
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "33: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+ !$acc end serial loop
+end subroutine gwv_sl_2
subroutine gwv_s_l ()
implicit none (type, external)
- integer :: i
+ integer :: i, j, k
!$acc serial ! { dg-message "72: enclosing parent compute construct" }
!$acc loop &
@@ -72,12 +91,25 @@ subroutine gwv_s_l ()
!$acc & vector(length:5) ! { dg-error "29: argument not permitted on 'vector' clause" }
do i = 0, 10
end do
- !$acc end serial
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "37: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+!$acc end serial
end subroutine gwv_s_l
subroutine gwv_r () ! { dg-message "16: enclosing routine" }
implicit none (type, external)
- integer :: i
+ integer :: i, j, k
!$acc routine(gwv_r)
@@ -87,4 +119,17 @@ subroutine gwv_r () ! { dg-message "16: enclosing routine" }
!$acc & vector(length:5) ! { dg-error "27: argument not permitted on 'vector' clause" }
do i = 0, 10
end do
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "31: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "31: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "36: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
end subroutine gwv_r
--
2.17.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-OpenACC-Use-proper-location-to-inform-of-enclosi.g10.patch --]
[-- Type: text/x-diff, Size: 7724 bytes --]
From a32d089dcf3edaa625e4871e78150b7d297cda5b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 3 Nov 2020 22:06:29 +0100
Subject: [PATCH] [OpenACC] Use proper location to 'inform' of enclosing parent
compute construct
Bug fix for recent commit beddd1762ad2bbe84dd776c54489153f83f21e56 "[OpenACC]
More precise diagnostics for 'gang', 'worker', 'vector' clauses with arguments
on 'loop' only allowed in 'kernels' regions":
> [...], and 'inform' at the location of the enclosing parent
> compute construct/[...].
Now really.
gcc/
* omp-low.c (scan_omp_for) <OpenACC>: Use proper location to
'inform' of enclosing parent compute construct.
gcc/testsuite/
* c-c++-common/goacc/pr92793-1.c: Extend.
* gfortran.dg/goacc/pr92793-1.f90: Likewise.
(cherry picked from commit fab72592d86d11b89a01f0f3c2c9c329d43466c1)
---
gcc/omp-low.c | 2 +-
gcc/testsuite/c-c++-common/goacc/pr92793-1.c | 58 +++++++++++++++++--
gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 | 55 ++++++++++++++++--
3 files changed, 104 insertions(+), 11 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 91e1bcc6b69a..b03575fefdf6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2436,7 +2436,7 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx)
"argument not permitted on %qs clause",
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
if (tgt)
- inform (gimple_location (outer_ctx->stmt),
+ inform (gimple_location (tgt->stmt),
"enclosing parent compute construct");
else if (oacc_get_fn_attrib (current_function_decl))
inform (DECL_SOURCE_LOCATION (current_function_decl),
diff --git a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
index 77ebb20265cf..71a556e27513 100644
--- a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
@@ -57,7 +57,7 @@ reduction(-:sum ) /* { dg-line sum2 } */ \
void
-a_sl() {
+gwv_sl_1() {
#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */ \
gang(num:5) /* { dg-error "5: argument not permitted on 'gang' clause" } */ \
worker(num:5) /* { dg-error "3: argument not permitted on 'worker' clause" } */ \
@@ -67,7 +67,25 @@ a_sl() {
}
void
-a_s_l() {
+gwv_sl_2() {
+#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "9: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
+}
+
+void
+gwv_s_l() {
#pragma acc serial /* { dg-message "9: enclosing parent compute construct" } */
{
#pragma acc loop \
@@ -76,18 +94,48 @@ a_s_l() {
vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
for (int i = 0; i < 10; i++)
;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "10: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "7: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "5: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
}
}
-void a_r();
-#pragma acc routine(a_r)
+void gwv_r();
+#pragma acc routine(gwv_r)
void
-a_r() { /* { dg-message "1: enclosing routine" } */
+gwv_r() { /* { dg-message "1: enclosing routine" } */
#pragma acc loop \
gang(num:5) /* { dg-error "4: argument not permitted on 'gang' clause" } */ \
worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
for (int i = 0; i < 10; i++)
;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "6: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "6: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
}
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
index 4651ccffaa1f..422131ba4734 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
@@ -47,7 +47,7 @@ subroutine check ()
end subroutine check
-subroutine gwv_sl ()
+subroutine gwv_sl_1 ()
implicit none (type, external)
integer :: i
@@ -59,11 +59,30 @@ subroutine gwv_sl ()
do i = 0, 10
end do
!$acc end serial loop
-end subroutine gwv_sl
+end subroutine gwv_sl_1
+
+subroutine gwv_sl_2 ()
+ implicit none (type, external)
+ integer :: i, j, k
+
+ !$acc serial loop ! { dg-message "77: enclosing parent compute construct" }
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "33: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+ !$acc end serial loop
+end subroutine gwv_sl_2
subroutine gwv_s_l ()
implicit none (type, external)
- integer :: i
+ integer :: i, j, k
!$acc serial ! { dg-message "72: enclosing parent compute construct" }
!$acc loop &
@@ -72,12 +91,25 @@ subroutine gwv_s_l ()
!$acc & vector(length:5) ! { dg-error "29: argument not permitted on 'vector' clause" }
do i = 0, 10
end do
- !$acc end serial
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "37: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+!$acc end serial
end subroutine gwv_s_l
subroutine gwv_r () ! { dg-message "16: enclosing routine" }
implicit none (type, external)
- integer :: i
+ integer :: i, j, k
!$acc routine(gwv_r)
@@ -87,4 +119,17 @@ subroutine gwv_r () ! { dg-message "16: enclosing routine" }
!$acc & vector(length:5) ! { dg-error "27: argument not permitted on 'vector' clause" }
do i = 0, 10
end do
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "31: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "31: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "36: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
end subroutine gwv_r
--
2.17.1
next prev parent reply other threads:[~2020-11-03 21:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 13:38 [Patch, Fortran] PR 92793 - fix column used for error diagnostic Tobias Burnus
2019-12-04 14:30 ` Harwath, Frederik
2019-12-06 8:02 ` *PING* – " Tobias Burnus
2019-12-06 16:42 ` Janne Blomqvist
2019-12-09 15:58 ` [PATCH] Fix column information for omp_clauses in Fortran code Harwath, Frederik
2019-12-09 16:03 ` Tobias Burnus
2019-12-10 14:23 ` [PATCH 0/2] Add tests to verify OpenACC clause locations Frederik Harwath
2019-12-10 14:44 ` Thomas Schwinge
2019-12-10 15:12 ` Harwath, Frederik
2019-12-10 16:22 ` Harwath, Frederik
2019-12-11 8:38 ` [PATCH, committed] Fix PR92901: Change test expectation for C++ in OpenACC test clause-locations.c Harwath, Frederik
2020-11-03 8:17 ` [PATCH 0/2] Add tests to verify OpenACC clause locations Thomas Schwinge
2020-11-03 21:34 ` Thomas Schwinge [this message]
2019-12-10 14:23 ` [PATCH 2/2] " Frederik Harwath
2019-12-10 14:23 ` [PATCH 1/2] Use clause locations in OpenACC nested reduction warnings Frederik Harwath
2020-11-03 8:26 ` [PATCH] Fix column information for omp_clauses in Fortran code Thomas Schwinge
2020-10-30 10:35 ` [Patch, Fortran] PR 92793 - fix column used for error diagnostic Thomas Schwinge
2020-10-30 10:47 ` Thomas Schwinge
2020-10-30 11:16 ` Tobias Burnus
2020-11-02 13:43 ` Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y2jidt06.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=frederik@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tobias@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).