[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Modif gfc_init_descriptor_variable
Mikael Morin
mikael@gcc.gnu.org
Wed Sep 17 12:58:45 GMT 2025
https://gcc.gnu.org/g:a1964fd4cc62df52daf8c4d99a6dadf7903fa170
commit a1964fd4cc62df52daf8c4d99a6dadf7903fa170
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Sat Jul 19 15:55:19 2025 +0200
Modif gfc_init_descriptor_variable
Diff:
---
gcc/fortran/trans-descriptor.cc | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index ac866343d074..b0ade4a70862 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -845,19 +845,26 @@ gfc_init_static_descriptor (tree descr)
void
gfc_init_descriptor_variable (stmtblock_t *block, gfc_symbol *sym, tree descr)
{
+ symbol_attribute attr = gfc_symbol_attr (sym);
+
/* NULLIFY the data pointer for non-saved allocatables, or for non-saved
pointers when -fcheck=pointer is specified. */
- if (sym->attr.allocatable
- || (sym->attr.pointer && (gfc_option.rtcheck & GFC_RTCHECK_POINTER)))
+ if (attr.allocatable
+ || (attr.pointer && (gfc_option.rtcheck & GFC_RTCHECK_POINTER)))
{
gfc_conv_descriptor_data_set (block, descr, null_pointer_node);
- if (flag_coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
+ if (flag_coarray == GFC_FCOARRAY_LIB && attr.codimension)
gfc_conv_descriptor_token_set (block, descr, null_pointer_node);
}
- gcc_assert (sym->as && sym->as->rank>=0);
+ gfc_array_spec *as;
+ if (sym->ts.type == BT_CLASS)
+ as = CLASS_DATA (sym)->as;
+ else
+ as = sym->as;
+
+ gcc_assert (as && as->rank >= 0);
tree etype = gfc_get_element_type (TREE_TYPE (descr));
gfc_conv_descriptor_dtype_set (block, descr,
- gfc_get_dtype_rank_type (sym->as->rank,
- etype));
+ gfc_get_dtype_rank_type (as->rank, etype));
}
More information about the Gcc-cvs
mailing list