Re: [PATCH] fortran: Create a dedicated type for ranks and array dimensions
Mikael Morin <[email protected]> Wed, 8 Jul 2026 11:14:38 +0200
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
Le 06/07/2026 à 22:02, Harald Anlauf a écrit : > Hi Mikael, > > On 7/6/26 11:35, Mikael Morin wrote: >> This started as an attempt to remove this annoying usage of >> gfc_conv_descriptor_rank in trans-array.cc(gfc_conv_array_parameter): >> >> 9278 tree idx = gfc_create_var (TREE_TYPE >> (gfc_conv_descriptor_rank >> 9279 (old_desc)), >> 9280 "idx"); >> >> That snippet was creating a data reference, and then throwing it away to >> only keep the type, which is the type of array descriptors' rank field. >> >> I could have used just the rank field type directly, but I eventually >> convinced myself that the snippet above showed a lack of a type readily >> available to represent ranks and array dimensions. This patchs adds >> such a type. >> >> As usual, I wasn't very inspired when choosing the name for it. Feel >> free to propose better. >> Regression tested on powerpc64le-unknown-linux-gnu. OK for master? > > this seems to be a nice improvement and looks fine to me. > > A stupid question: have you considered a conversion of the result > of gfc_get_cfi_desc_rank already in the getter in trans-array.cc? > This could lead to simpler code in trans-decl.cc::gfc_conv_cfi_to_gfc > where it is used, unless I missed something. After a quick investigation, it seems the function is also used to assign to the field (see gfc_conv_gfc_desc_to_cfi_desc in trans-expr.cc), so I prefer to keep unmodified the type of the data reference tree returned by the function. I received an aarch64 regression notification from the linaro CI bot, but could not reproduce it, so I will push the patch as submitted and see what happens. Thanks for the review.