public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: passing of optional dummies to elemental procedures [PR113377]
Date: Wed, 24 Jan 2024 19:46:30 +0100	[thread overview]
Message-ID: <2c7591cc-6660-4323-98b2-1b0a8f69628e@orange.fr> (raw)
In-Reply-To: <trinity-6e63c714-b838-426d-8e13-b7bd92c0a4ec-1706042201181@3c-app-gmx-bs40>

Le 23/01/2024 à 21:36, Harald Anlauf a écrit :
> Dear all,
> 
> here's the second part of a series for the treatment of missing
> optional arguments passed to optional dummies, now fixing the
> case that the latter procedures are elemental.  Adjustments
> were necessary when the missing dummy has the VALUE attribute.
> 
> I factored the code for the treatment of VALUE, hoping that the
> monster loop in gfc_conv_procedure_call will become slightly
> easier to overlook.
> 
> Regtested on x86_64-pc-linux-gnu.  OK for mainline?
> 
Looks good, but...

> Thanks,
> Harald
> 

> 
> diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> index 128add47516..0fac0523670 100644
> --- a/gcc/fortran/trans-expr.cc
> +++ b/gcc/fortran/trans-expr.cc

> @@ -6392,12 +6479,23 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
>  		}
>  	    }
> 
> +	  /* Scalar dummy arguments of intrinsic type with VALUE attribute.  */
> +	  if (fsym
> +	      && fsym->attr.value
> +	      && !fsym->attr.dimension
> +	      // && (fsym->ts.type != BT_CHARACTER
> +	      // 	  || gfc_length_one_character_type_p (&fsym->ts))

... please remove the commented code here.  OK with that change.
The !fsym->attr.dimension condition could be removed as well as we are 
in the case of an elemental procedure at this point, but it doesn't harm 
if you prefer keeping it.
Thanks for the patch.

Mikael

> +	      && fsym->ts.type != BT_DERIVED
> +	      && fsym->ts.type != BT_CLASS)
> +	    conv_dummy_value (&parmse, e, fsym, optionalargs);
> +
>  	  /* If we are passing an absent array as optional dummy to an
>  	     elemental procedure, make sure that we pass NULL when the data
>  	     pointer is NULL.  We need this extra conditional because of
>  	     scalarization which passes arrays elements to the procedure,
>  	     ignoring the fact that the array can be absent/unallocated/...  */
> -	  if (ss->info->can_be_null_ref && ss->info->type != GFC_SS_REFERENCE)
> +	  else if (ss->info->can_be_null_ref
> +		   && ss->info->type != GFC_SS_REFERENCE)
>  	    {
>  	      tree descriptor_data;
> 


  reply	other threads:[~2024-01-24 18:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 20:36 Harald Anlauf
2024-01-24 18:46 ` Mikael Morin [this message]
2024-01-24 19:35   ` Harald Anlauf
2024-01-24 19:35     ` Harald Anlauf

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=2c7591cc-6660-4323-98b2-1b0a8f69628e@orange.fr \
    --to=morin-mikael@orange.fr \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).