[gcc(refs/users/mikael/heads/refactor_descriptor_v291.01)] Extraction gfc_init_static_descriptor

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:526220bf1fc27b06c875817f2c4fce8a024de8f8

commit 526220bf1fc27b06c875817f2c4fce8a024de8f8
Author: Mikael Morin <[email protected]>
Date:   Tue Jul 15 21:06:28 2025 +0200

    Extraction gfc_init_static_descriptor
    
    Correction compilation
    
    Renommage gfc_clear_descriptor -> gfc_init_static_descriptor

Diff:
---
 gcc/fortran/trans-array.cc      | 6 +-----
 gcc/fortran/trans-descriptor.cc | 8 ++++++++
 gcc/fortran/trans-descriptor.h  | 1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 91fa43b26831..d8c6a102d285 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -627,12 +627,8 @@ gfc_get_array_span (tree desc, gfc_expr *expr)
 void
 gfc_trans_static_array_pointer (gfc_symbol * sym)
 {
-  tree type;
-
   gcc_assert (TREE_STATIC (sym->backend_decl));
-  /* Just zero the data member.  */
-  type = TREE_TYPE (sym->backend_decl);
-  DECL_INITIAL (sym->backend_decl) = gfc_build_null_descriptor (type);
+  gfc_init_static_descriptor (sym->backend_decl);
 }
 
 
diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index a2b5ffe01d4a..088ea82ff0b2 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -897,3 +897,11 @@ gfc_init_absent_descriptor (stmtblock_t *block, tree descr)
 {
   gfc_conv_descriptor_data_set (block, descr, null_pointer_node);
 }
+
+
+void
+gfc_init_static_descriptor (tree descr)
+{
+  tree type = TREE_TYPE (descr);
+  DECL_INITIAL (descr) = gfc_build_null_descriptor (type);
+}
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 2d46b5b35c81..cd4820e9146c 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -77,5 +77,6 @@ void gfc_grow_array (stmtblock_t *, tree, tree);
 void gfc_nullify_descriptor (stmtblock_t *block, tree);
 void gfc_init_descriptor_result (stmtblock_t *block, tree descr);
 void gfc_init_absent_descriptor (stmtblock_t *block, tree descr);
+void gfc_init_static_descriptor (tree descr);
 
 #endif /* GFC_TRANS_DESCRIPTOR_H */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.