https://gcc.gnu.org/g:8eda72e6919a2e4319fa44dc56ef25ffa14c0c6d
commit 8eda72e6919a2e4319fa44dc56ef25ffa14c0c6d Author: Mikael Morin <[email protected]> Date: Thu Oct 23 12:28:55 2025 +0200 fortran: array descriptor: Rename dim subfields internal accessors [PR122521] Regression tested on aarch64-unknown-linux-gnu. OK for master? -- >8 -- Drop the gfc prefix from the internal function giving access to the lbound, ubound, and stride fields. This aligns the function names with the rest of the compiler dropping the prefix for static functions. PR fortran/122521 gcc/fortran/ChangeLog: * trans-descriptor.cc (gfc_conv_descriptor_stride): Rename ... (conv_descriptor_stride): ... to this. (gfc_conv_descriptor_stride_get, gfc_conv_descriptor_stride_set): Update caller. (gfc_conv_descriptor_lbound): Rename ... (conv_descriptor_lbound): ... to this. (gfc_conv_descriptor_lbound_get, gfc_conv_descriptor_lbound_set): Update caller. (gfc_conv_descriptor_ubound): Rename ... (conv_descriptor_ubound): ... to this. (gfc_conv_descriptor_ubound_get, gfc_conv_descriptor_ubound_set): Update caller. Diff: --- gcc/fortran/trans-descriptor.cc | 51 +++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 72c8b9c5f2b1..b0379f6470aa 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -451,6 +451,9 @@ gfc_conv_descriptor_token_set (stmtblock_t *block, tree desc, tree value) } +/* Return a reference to the FIELD_IDX'th subfield of the dimension descriptor + of the (zero-based) dimension DIM of the array descriptor DESC. */ + static tree gfc_conv_descriptor_subfield (tree desc, tree dim, unsigned field_idx) { @@ -462,14 +465,21 @@ gfc_conv_descriptor_subfield (tree desc, tree dim, unsigned field_idx) tmp, field, NULL_TREE); } + +/* Return a reference to the stride field of the (zero-based) dimension DIM of + the array descriptor DESC. */ + static tree -gfc_conv_descriptor_stride (tree desc, tree dim) +conv_descriptor_stride (tree desc, tree dim) { tree field = gfc_conv_descriptor_subfield (desc, dim, STRIDE_SUBFIELD); gcc_assert (TREE_TYPE (field) == gfc_array_index_type); return field; } +/* Return the stride value for the (zero-based) dimension DIM of the array + descriptor DESC. */ + tree gfc_conv_descriptor_stride_get (tree desc, tree dim) { @@ -484,58 +494,81 @@ gfc_conv_descriptor_stride_get (tree desc, tree dim) || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT)) return gfc_index_one_node; - return gfc_conv_descriptor_stride (desc, dim); + return conv_descriptor_stride (desc, dim); } +/* Add code to BLOCK assigning VALUE to the stride field of the (zero-based) + dimension DIM of the array descriptor DESC. */ + void gfc_conv_descriptor_stride_set (stmtblock_t *block, tree desc, tree dim, tree value) { - tree t = gfc_conv_descriptor_stride (desc, dim); + tree t = conv_descriptor_stride (desc, dim); gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value)); } + +/* Return a reference to the lower bound field of the (zero-based) dimension DIM + of the array descriptor DESC. */ + static tree -gfc_conv_descriptor_lbound (tree desc, tree dim) +conv_descriptor_lbound (tree desc, tree dim) { tree field = gfc_conv_descriptor_subfield (desc, dim, LBOUND_SUBFIELD); gcc_assert (TREE_TYPE (field) == gfc_array_index_type); return field; } +/* Return the lower bound value for the (zero-based) dimension DIM of the array + descriptor DESC. */ + tree gfc_conv_descriptor_lbound_get (tree desc, tree dim) { - return gfc_conv_descriptor_lbound (desc, dim); + return conv_descriptor_lbound (desc, dim); } +/* Add code to BLOCK assigning VALUE to the lower bound field of the + (zero-based) dimension DIM of the array descriptor DESC. */ + void gfc_conv_descriptor_lbound_set (stmtblock_t *block, tree desc, tree dim, tree value) { - tree t = gfc_conv_descriptor_lbound (desc, dim); + tree t = conv_descriptor_lbound (desc, dim); gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value)); } + +/* Return a reference to the upper bound field of the (zero-based) dimension DIM + of the array descriptor DESC. */ + static tree -gfc_conv_descriptor_ubound (tree desc, tree dim) +conv_descriptor_ubound (tree desc, tree dim) { tree field = gfc_conv_descriptor_subfield (desc, dim, UBOUND_SUBFIELD); gcc_assert (TREE_TYPE (field) == gfc_array_index_type); return field; } +/* Return the upper bound value for the (zero-based) dimension DIM of the array + descriptor DESC. */ + tree gfc_conv_descriptor_ubound_get (tree desc, tree dim) { - return gfc_conv_descriptor_ubound (desc, dim); + return conv_descriptor_ubound (desc, dim); } +/* Add code to BLOCK assigning VALUE to the upper bound field of the + (zero-based) dimension DIM of the array descriptor DESC. */ + void gfc_conv_descriptor_ubound_set (stmtblock_t *block, tree desc, tree dim, tree value) { - tree t = gfc_conv_descriptor_ubound (desc, dim); + tree t = conv_descriptor_ubound (desc, dim); gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value)); }
