From: Harald Anlauf <anlauf@gmx.de>
To: Mikael Morin <morin-mikael@orange.fr>,
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 20:35:08 +0100 [thread overview]
Message-ID: <754520cc-597a-4c96-b901-45a6b1998702@gmx.de> (raw)
In-Reply-To: <2c7591cc-6660-4323-98b2-1b0a8f69628e@orange.fr>
Hi Mikael,
Am 24.01.24 um 19:46 schrieb Mikael Morin:
> 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.
Duh! I completely missed that during cleanup.
> 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.
You're absolutely right. I've removed it.
> Thanks for the patch.
Thanks for the review!
Harald
> 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;
>>
>
>
WARNING: multiple messages have this Message-ID
From: Harald Anlauf <anlauf@gmx.de>
To: gcc-patches@gcc.gnu.org
Cc: fortran@gcc.gnu.org
Subject: Re: [PATCH] Fortran: passing of optional dummies to elemental procedures [PR113377]
Date: Wed, 24 Jan 2024 20:35:08 +0100 [thread overview]
Message-ID: <754520cc-597a-4c96-b901-45a6b1998702@gmx.de> (raw)
Message-ID: <20240124193508.hgZu2RnX5AKY4pgZvIfaGm2ZUrmE9ELLRxdRMXRB0_4@z> (raw)
In-Reply-To: <2c7591cc-6660-4323-98b2-1b0a8f69628e@orange.fr>
Hi Mikael,
Am 24.01.24 um 19:46 schrieb Mikael Morin:
> 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.
Duh! I completely missed that during cleanup.
> 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.
You're absolutely right. I've removed it.
> Thanks for the patch.
Thanks for the review!
Harald
> 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;
>>
>
>
next prev parent reply other threads:[~2024-01-24 19:35 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
2024-01-24 19:35 ` Harald Anlauf [this message]
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=754520cc-597a-4c96-b901-45a6b1998702@gmx.de \
--to=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=morin-mikael@orange.fr \
/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).