public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP/Fortran: Handle polymorphic scalars in data-sharing FIRSTPRIVATE [PR86470]
Date: Mon, 24 May 2021 16:06:50 +0200	[thread overview]
Message-ID: <20210524140650.GC1179226@tucnak> (raw)
In-Reply-To: <9b270c75-b88c-7477-1303-5f4f5a6662ae@codesourcery.com>

On Wed, Mar 10, 2021 at 11:55:43AM +0100, Tobias Burnus wrote:
> --- a/gcc/fortran/trans-openmp.c
> +++ b/gcc/fortran/trans-openmp.c
> @@ -360,6 +360,39 @@ gfc_has_alloc_comps (tree type, tree decl)
>    return false;
>  }
>  
> +/* Return true if TYPE is polymorphic but not with pointer attribute.  */
> +
> +static bool
> +gfc_is_polymorphic_nonptr (tree type)
> +{
> +  if (POINTER_TYPE_P (type))
> +    type = TREE_TYPE (type);
> +  return GFC_CLASS_TYPE_P (type);
> +}
> +
> +/* Return true if TYPE is unlimited polymorphic but not with pointer attribute;
> +   unlimited means also intrinsic types are handled and _len is used.  */
> +
> +static bool
> +gfc_is_unlimited_polymorphic_nonptr (tree type)
> +{
> +  if (POINTER_TYPE_P (type))
> +    type = TREE_TYPE (type);
> +  if (!GFC_CLASS_TYPE_P (type))
> +    return false;
> +
> +  tree field = TYPE_FIELDS (type); /* _data */
> +  gcc_assert (field);
> +  field = DECL_CHAIN (field); /* _vptr */
> +  gcc_assert (field);
> +  field = DECL_CHAIN (field);
> +  if (!field)
> +    return false;
> +  gcc_assert (0 == strcmp ("_len", IDENTIFIER_POINTER (DECL_NAME (field))));

strcmp (...) == 0 instead please.

> +  return true;
> +}
> +
> +
>  /* Return true if DECL in private clause needs
>     OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause.  */
>  bool
> @@ -743,12 +776,88 @@ tree
>  gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
>  {
>    tree type = TREE_TYPE (dest), ptr, size, call;
> +  tree decl_type = TREE_TYPE (OMP_CLAUSE_DECL (clause));
>    tree cond, then_b, else_b;
>    stmtblock_t block, cond_block;
>  
>    gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE
>  	      || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LINEAR);
>  
> +  if (DECL_ARTIFICIAL (OMP_CLAUSE_DECL (clause))
> +      && DECL_LANG_SPECIFIC (OMP_CLAUSE_DECL (clause))
> +      && GFC_DECL_SAVED_DESCRIPTOR (OMP_CLAUSE_DECL (clause)))
> +    decl_type
> +	= TREE_TYPE (GFC_DECL_SAVED_DESCRIPTOR (OMP_CLAUSE_DECL (clause)));

Indentation, decl_type is indented by 4 spaces, but this line by tab (== 8 sp).

Otherwise LGTM, sorry for the delay.

	Jakub


  parent reply	other threads:[~2021-05-24 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 10:55 Tobias Burnus
2021-05-23  9:47 ` Tobias Burnus
2021-05-24 14:06 ` Jakub Jelinek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-25 10:50 [Patch] OpenMP/Fortran: Handle polymorphic scalars in data-sharing FIRSTPRIVATE (PR86470) Tobias Burnus
2020-08-31  8:28 ` Tobias Burnus
2020-08-31 10:55 ` Andre Vehreschild
2020-08-31 13:58   ` Tobias Burnus
2020-08-31 16:34 ` 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=20210524140650.GC1179226@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --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).