From: Tobias Burnus <tobias@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: [Patch] Fortran/OpenMP: Fix var-list expr parsing with array/dt (was: [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause)
Date: Wed, 28 Apr 2021 22:26:44 +0200 [thread overview]
Message-ID: <adcbe0b5-ac72-e32f-fcbd-4c4b4c59122e@codesourcery.com> (raw)
In-Reply-To: <20210428134143.GP1179226@tucnak>
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On 28.04.21 15:41, Jakub Jelinek wrote:
>> @@ -261,6 +263,7 @@ gfc_match_omp_variable_list (const char *str, gfc_omp_namelist **list,
>> + gfc_gobble_whitespace ();
>> if ((allow_sections && gfc_peek_ascii_char () == '(')
>> || (allow_derived && gfc_peek_ascii_char () == '%')
> Is this change specific to depend/affinity or iterators?
> If not, shouldn't it go in separately and with a testcase that shows when it
> is needed?
I encountered it when writing a testcase - and the testcase was using it.
However, if you think it makes sense to have it separately.
It fixes the issue:
7 | !$omp target enter data map( to: a (:) )
| 1
Error: Syntax error in OpenMP variable list at (1)
OK for mainline?
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
[-- Attachment #2: var-space.diff --]
[-- Type: text/x-patch, Size: 1385 bytes --]
Fortran/OpenMP: Fix var-list expr parsing with array/dt
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_variable_list): Gobble whitespace before
checking whether a '%' or '(' follows as next character.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/map-5.f90: New test.
gcc/fortran/openmp.c | 1 +
gcc/testsuite/gfortran.dg/gomp/map-5.f90 | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index a1b057227b7..7eeabff8e76 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -261,6 +261,7 @@ gfc_match_omp_variable_list (const char *str, gfc_omp_namelist **list,
case MATCH_YES:
gfc_expr *expr;
expr = NULL;
+ gfc_gobble_whitespace ();
if ((allow_sections && gfc_peek_ascii_char () == '(')
|| (allow_derived && gfc_peek_ascii_char () == '%'))
{
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-5.f90 b/gcc/testsuite/gfortran.dg/gomp/map-5.f90
new file mode 100644
index 00000000000..2b4b341bc51
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-5.f90
@@ -0,0 +1,13 @@
+implicit none
+type t
+ integer :: b(5)
+end type t
+integer :: a(5), x, y(5)
+type(t) :: b
+!$omp target enter data map( to: a (:) )
+!$omp target enter data map( to: b % b )
+!$omp target enter data map( to: a(:) )
+!$omp target depend(out: y (2)) nowait
+!$omp end target
+
+end
next prev parent reply other threads:[~2021-04-28 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 13:36 [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause Tobias Burnus
2021-04-28 13:41 ` Jakub Jelinek
2021-04-28 20:26 ` Tobias Burnus [this message]
2021-04-28 20:31 ` [Patch] Fortran/OpenMP: Fix var-list expr parsing with array/dt (was: [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause) Jakub Jelinek
[not found] ` <3bfa68db-f904-a1cb-0d18-c1a17ecfc720@codesourcery.com>
[not found] ` <20210527082259.GM7746@tucnak>
2021-05-27 18:30 ` [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause Tobias Burnus
2021-05-27 18:42 ` Jakub Jelinek
2021-05-27 19:58 ` Joseph Myers
2021-05-27 20:15 ` Jakub Jelinek
2021-05-27 22:59 ` Tobias Burnus
2021-05-29 8:03 ` Jakub Jelinek
2021-05-31 8:14 ` Christophe Lyon
2021-05-31 8:19 ` Jakub Jelinek
2021-05-31 14:43 ` Tobias Burnus
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=adcbe0b5-ac72-e32f-fcbd-4c4b4c59122e@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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).