Re-bonjour Mikael!

Again, this is OK to push.

Regards

Paul

On Sat, 1 Nov 2025 at 20:59, Mikael Morin <[email protected]> wrote:
>
> From: Mikael Morin <[email protected]>
>
> Regression tested on powerpc64le-unknown-linux-gnu.  OK for master?
>
> -- >8 --
>
> Add a static function producing a reference to the data field of array
> descriptors, like those existing for the other fields.
>
> gcc/fortran/ChangeLog:
>
>         * trans-descriptor.cc (conv_descriptor_data): New function.
>         (gfc_conv_descriptor_data_get, gfc_conv_descriptor_data_set): Use
>         it.
> ---
>  gcc/fortran/trans-descriptor.cc | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
> index 450d5add38d..78248ac30e8 100644
> --- a/gcc/fortran/trans-descriptor.cc
> +++ b/gcc/fortran/trans-descriptor.cc
> @@ -89,6 +89,15 @@ gfc_get_descriptor_field (tree desc, unsigned field_idx)
>                           desc, field, NULL_TREE);
>  }
>
> +
> +/* Return a reference to the data field of the array descriptor DESC.  */
> +
> +static tree
> +conv_descriptor_data (tree desc)
> +{
> +  return gfc_get_descriptor_field (desc, DATA_FIELD);
> +}
> +
>  /* This provides READ-ONLY access to the data field.  The field itself
>     doesn't have the proper type.  */
>
> @@ -99,7 +108,7 @@ gfc_conv_descriptor_data_get (tree desc)
>    if (TREE_CODE (type) == REFERENCE_TYPE)
>      gcc_unreachable ();
>
> -  tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
> +  tree field = conv_descriptor_data (desc);
>    return fold_convert (GFC_TYPE_ARRAY_DATAPTR_TYPE (type), field);
>  }
>
> @@ -108,7 +117,7 @@ gfc_conv_descriptor_data_get (tree desc)
>  void
>  gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
>  {
> -  tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
> +  tree field = conv_descriptor_data (desc);
>    gfc_add_modify (block, field, fold_convert (TREE_TYPE (field), value));
>  }
>
> --
> 2.51.0
>

Reply via email to