https://gcc.gnu.org/g:fe50fc2518e382ab97ef002533b2f185861bab5f
commit r17-2548-gfe50fc2518e382ab97ef002533b2f185861bab5f Author: Mikael Morin <[email protected]> Date: Mon Jul 20 11:09:11 2026 +0200 fortran: array descriptor: Remove access to dim field elements [PR122521] 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. Diff: --- 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 2b67776de4a6..61d5cf3c1894 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 5daeb349f26d..a17d4aca9e47 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);
