[PATCH 07/11] fortran: array descriptor: Remove access to the attribute field

Tobias Burnus tburnus@baylibre.com
Mon Dec 8 14:38:19 GMT 2025


Hi all,

Mikael Morin wrote:
> The attribute field is not used, this removes the single function giving
> direct access to it.

I find this quite interesting, but I can confirm it. For type declaration,
it is added to the descriptor, but not initialized.

libgfortran.h offers GFC_DTYPE_CLEAR that sets it to 0;
it was used byruntime/ISO_Fortran_binding.c's
cfi_desc_to_gfc_desc and gfc_desc_to_cfi_desc, but those
are now generated inside the compiler - and uses the
attribute based on the declaration instead of the one of
the descriptor.

But, interestingly, not even gfc_get_dtype_rank_type set it!

Note: For the ISO C Binding descriptor it is used:
CFI_attribute_pointer, CFI_attribute_allocatable, CFI_attribute_other
but that's handled elsewhere → gfc_get_cfi_desc_attribute
and is (at least for now) a different descriptor.


> gcc/fortran/ChangeLog:
>
> 	* trans-descriptor.cc (gfc_conv_descriptor_attribute): Remove
> 	function.
> 	* trans-descriptor.h (gfc_conv_descriptor_attribute): Remove
> 	declaration.

LGTM. Thanks!

Tobias



More information about the Fortran mailing list