[PATCH 08/12] fortran: array descriptor: Remove access to dim field elements [PR122521]
Mikael Morin <[email protected]> Sat, 11 Jul 2026 16:46:35 +0200
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
From: Mikael Morin <[email protected]> In the version 1 of this series, two accessors were added to give read and write access to the individual dimension descriptors of the dim array. The single place using them has changed since then, and they are no longer necessary. This version only removes the direct access function from the public API without adding accessors. Regression tested on aarch64-unknown-linux-gnu. OK for master? -- >8 -- Remove from the public API the function giving direct acces to individual dimension descriptors. Another function remains giving access to the full array of dimension descriptors. PR fortran/122521 gcc/fortran/ChangeLog: * trans-descriptor.cc (gfc_conv_descriptor_dimension): Make static and rename ... (conv_descriptor_dimension): ... to this. (gfc_conv_descriptor_subfield): Update caller. * trans-descriptor.h (gfc_conv_descriptor_dimension): Remove declaration. --- gcc/fortran/trans-descriptor.cc | 12 +++++++++--- gcc/fortran/trans-descriptor.h | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 2b67776de4a..61d5cf3c189 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -397,6 +397,9 @@ gfc_conv_descriptor_type_set (tree desc, int value) } +/* Return a reference to the array of dimension descriptors of the array + descriptor DESC. */ + tree gfc_get_descriptor_dimension (tree desc) { @@ -407,8 +410,11 @@ gfc_get_descriptor_dimension (tree desc) } -tree -gfc_conv_descriptor_dimension (tree desc, tree dim) +/* Return a reference to the dimension descriptor for the (zero-based) dimension + DIM of the array descriptor DESC. */ + +static tree +conv_descriptor_dimension (tree desc, tree dim) { tree tmp; @@ -432,7 +438,7 @@ gfc_conv_descriptor_token (tree desc) static tree gfc_conv_descriptor_subfield (tree desc, tree dim, unsigned field_idx) { - tree tmp = gfc_conv_descriptor_dimension (desc, dim); + tree tmp = conv_descriptor_dimension (desc, dim); tree field = gfc_advance_chain (TYPE_FIELDS (TREE_TYPE (tmp)), field_idx); gcc_assert (field != NULL_TREE); diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h index 5daeb349f26..a17d4aca9e4 100644 --- a/gcc/fortran/trans-descriptor.h +++ b/gcc/fortran/trans-descriptor.h @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see tree gfc_get_descriptor_dimension (tree); -tree gfc_conv_descriptor_dimension (tree, tree); tree gfc_conv_descriptor_token (tree); tree gfc_conv_descriptor_data_get (tree); -- 2.53.0