From: Kwok Cheung Yeung <kcy@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>,
Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
fortran <fortran@gcc.gnu.org>, <gscfq@t-online.de>
Subject: Re: [PATCH] openmp, fortran: Check that event handles passed to detach clauses are not arrays [PR104131]
Date: Mon, 28 Feb 2022 14:27:02 +0000 [thread overview]
Message-ID: <383792f1-a5c7-af10-c603-2f1332336648@codesourcery.com> (raw)
In-Reply-To: <YhzXMQRcRjXaiVMj@tucnak>
On 28/02/2022 2:07 pm, Jakub Jelinek wrote:
> On Mon, Feb 28, 2022 at 02:01:03PM +0000, Kwok Cheung Yeung wrote:
>> diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
>> index 19142c4d8d0..50a1c476009 100644
>> --- a/gcc/fortran/openmp.cc
>> +++ b/gcc/fortran/openmp.cc
>> @@ -531,9 +531,10 @@ gfc_match_omp_detach (gfc_expr **expr)
>> if (gfc_match_variable (expr, 0) != MATCH_YES)
>> goto syntax_error;
>>
>> - if ((*expr)->ts.type != BT_INTEGER || (*expr)->ts.kind != gfc_c_intptr_kind)
>> + if ((*expr)->ts.type != BT_INTEGER || (*expr)->ts.kind != gfc_c_intptr_kind
>> + || (*expr)->symtree->n.sym->as)
>
> Don't we usually test instead || (*expr)->rank != 0 when testing for
> scalars?
>
> Jakub
>
If I run GCC in GDB on the pr104131.f90 testcase and inspect the expr, I
get:
534 if ((*expr)->ts.type != BT_INTEGER || (*expr)->ts.kind !=
gfc_c_intptr_kind
(gdb) p **expr
$2 = {expr_type = EXPR_VARIABLE, ts = {type = BT_INTEGER, kind = 8, u =
{derived = 0x0, cl = 0x0, pad = 0}, interface = 0x0, is_c_interop = 1,
is_iso_c = 0, f90_type = BT_INTEGER, deferred = false, interop_kind =
0x2e3fb80}, rank = 0, shape = 0x0, symtree = 0x2e3ffe0, ref = 0x2e3e600,
where = { ...
So (*expr)->rank is 0 here even with an array. I'm not sure why - is
rank updated later, or did we forget to call something on the event
handle expression?
Testing against n->sym->as for an array check has been used elsewhere in
openmp.cc, to prevent reductions against arrays in OpenACC in
resolve_omp_clauses.
Kwok
next prev parent reply other threads:[~2022-02-28 14:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 14:01 Kwok Cheung Yeung
2022-02-28 14:07 ` Jakub Jelinek
2022-02-28 14:27 ` Kwok Cheung Yeung [this message]
2022-02-28 15:54 ` Mikael Morin
2022-02-28 16:00 ` Jakub Jelinek
2022-02-28 17:33 ` Mikael Morin
2022-02-28 17:37 ` Jakub Jelinek
2022-02-28 18:38 ` Kwok Cheung Yeung
2022-02-28 20:37 ` Mikael Morin
2022-02-28 20:45 ` Mikael Morin
2022-02-28 21:37 ` Jakub Jelinek
2022-02-28 22:36 ` Mikael Morin
2022-03-01 7:58 ` Tobias Burnus
2022-03-01 8:16 ` Jakub Jelinek
2022-03-01 9:17 ` Tobias Burnus
2022-03-01 15:37 ` Mikael Morin
2022-03-02 17:22 ` [PATCH][v2] openmp, fortran: Check that the type of an event handle in a detach clause is suitable [PR104131] Kwok Cheung Yeung
2022-03-02 17:31 ` Jakub Jelinek
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=383792f1-a5c7-af10-c603-2f1332336648@codesourcery.com \
--to=kcy@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gscfq@t-online.de \
--cc=jakub@redhat.com \
--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).