https://gcc.gnu.org/g:1e4728f0ad3f66c31999abb334095333bfe7a44b

commit 1e4728f0ad3f66c31999abb334095333bfe7a44b
Author: Mikael Morin <[email protected]>
Date:   Sun Jun 29 14:28:16 2025 +0200

    fortran: array descriptor: Remove access to dim field elements [PR122521]
    
    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 powerpc64le-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.

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 d5db90cac408..c9913db3b1f1 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);

Reply via email to