[gcc(refs/users/mikael/heads/refactor_descriptor_v07)] Suppression gfc_conv_descriptor_type compil' OK
Mikael Morin
mikael@gcc.gnu.org
Mon Jun 30 09:49:48 GMT 2025
https://gcc.gnu.org/g:e06df85f61849048cf2b2bb9bdd1f764175d9e01
commit e06df85f61849048cf2b2bb9bdd1f764175d9e01
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Sun Jun 29 14:11:50 2025 +0200
Suppression gfc_conv_descriptor_type compil' OK
Diff:
---
gcc/fortran/trans-decl.cc | 2 +-
gcc/fortran/trans-descriptor.cc | 19 +++++++++++++++++--
gcc/fortran/trans-descriptor.h | 3 ++-
gcc/fortran/trans-expr.cc | 2 +-
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index fda3f34682ec..e3e41cc6c12d 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -7283,7 +7283,7 @@ gfc_conv_cfi_to_gfc (stmtblock_t *init, stmtblock_t *finally,
ctype = fold_build2_loc (input_location, BIT_AND_EXPR, TREE_TYPE (ctype),
ctype, build_int_cst (TREE_TYPE (ctype),
CFI_type_mask));
- tree type = gfc_conv_descriptor_type (gfc_desc);
+ tree type = gfc_conv_descriptor_type_get (gfc_desc);
/* if (CFI_type_cptr) BT_VOID else BT_UNKNOWN */
/* Note: BT_VOID is could also be CFI_type_funcptr, but assume c_ptr. */
diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 77ef2e16e13b..e0e41636b443 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -391,8 +391,9 @@ gfc_conv_descriptor_attribute (tree desc)
dtype, tmp, NULL_TREE);
}
-tree
-gfc_conv_descriptor_type (tree desc)
+
+static tree
+get_descriptor_type (tree desc)
{
tree tmp;
tree dtype;
@@ -405,6 +406,20 @@ gfc_conv_descriptor_type (tree desc)
dtype, tmp, NULL_TREE);
}
+tree
+gfc_conv_descriptor_type_get (tree desc)
+{
+ return non_lvalue_loc (input_location, get_descriptor_type (desc));
+}
+
+void
+gfc_conv_descriptor_type_set (stmtblock_t *block, tree desc, tree value)
+{
+ tree t = get_descriptor_type (desc);
+ gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+}
+
+
tree
gfc_get_descriptor_dimension (tree desc)
{
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 54420824c8eb..d552d1991489 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -30,7 +30,6 @@ tree gfc_get_cfi_dim_sm (tree desc, tree idx);
tree gfc_conv_descriptor_attribute (tree desc);
-tree gfc_conv_descriptor_type (tree desc);
tree gfc_get_descriptor_dimension (tree desc);
tree gfc_conv_descriptor_dimension (tree desc, tree dim);
tree gfc_conv_descriptor_token (tree desc);
@@ -41,6 +40,7 @@ tree gfc_conv_descriptor_dtype_get (tree desc);
tree gfc_conv_descriptor_elem_len_get (tree desc);
tree gfc_conv_descriptor_version_get (tree desc);
tree gfc_conv_descriptor_rank_get (tree desc);
+tree gfc_conv_descriptor_type_get (tree desc);
tree gfc_conv_descriptor_span_get (tree desc);
tree gfc_conv_descriptor_stride_get (tree desc, tree dim);
@@ -55,6 +55,7 @@ void gfc_conv_descriptor_elem_len_set (stmtblock_t *block, tree desc, tree value
void gfc_conv_descriptor_version_set (stmtblock_t *block, tree desc, tree value);
void gfc_conv_descriptor_rank_set (stmtblock_t *block, tree desc, tree value);
void gfc_conv_descriptor_rank_set (stmtblock_t *block, tree desc, int value);
+void gfc_conv_descriptor_type_set (stmtblock_t *block, tree desc, int value);
void gfc_conv_descriptor_span_set (stmtblock_t *block, tree desc, tree value);
void gfc_conv_descriptor_stride_set (stmtblock_t *block, tree desc, tree dim, tree value);
void gfc_conv_descriptor_lbound_set (stmtblock_t *block, tree desc, tree dim, tree value);
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index bbc9a2cd315d..d46c43857dc7 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -6228,7 +6228,7 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
tree cond;
tree ctype = gfc_get_cfi_desc_type (cfi);
tree type = fold_convert (TREE_TYPE (ctype),
- gfc_conv_descriptor_type (gfc));
+ gfc_conv_descriptor_type_get (gfc));
tree kind = fold_convert (TREE_TYPE (ctype),
gfc_conv_descriptor_elem_len_get (gfc));
kind = fold_build2_loc (input_location, LSHIFT_EXPR, TREE_TYPE (type),
More information about the Gcc-cvs
mailing list