https://gcc.gnu.org/g:e7f81b7e4e8f320a1b4f36d9d82d7bcd076df9d9
commit e7f81b7e4e8f320a1b4f36d9d82d7bcd076df9d9 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed Jul 16 16:49:28 2025 +0200 Extraction fonction gfc_nullify_descriptor Diff: --- gcc/fortran/trans-descriptor.cc | 6 ++++++ gcc/fortran/trans-descriptor.h | 5 ++++- gcc/fortran/trans-expr.cc | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 3adcf8256fe6..69b1cabd2528 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -935,3 +935,9 @@ gfc_conv_shift_descriptor (stmtblock_t *block, tree desc, conv_shift_descriptor (block, desc, as); } + +void +gfc_nullify_descriptor (stmtblock_t *block, tree descr) +{ + gfc_conv_descriptor_data_set (block, descr, null_pointer_node); +} diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h index d9c309b1b18c..57abd94c51f3 100644 --- a/gcc/fortran/trans-descriptor.h +++ b/gcc/fortran/trans-descriptor.h @@ -19,7 +19,6 @@ along with GCC; see the file COPYING3. If not see #ifndef GFC_TRANS_DESCRIPTOR_H #define GFC_TRANS_DESCRIPTOR_H -tree gfc_build_default_class_descriptor (const gfc_typespec &, tree); void gfc_set_scalar_null_descriptor (stmtblock_t *block, tree, gfc_symbol *, gfc_expr *, tree); void gfc_set_descriptor_with_shape (stmtblock_t *, tree, tree, gfc_expr *, locus *); @@ -93,12 +92,16 @@ gfc_get_descriptor_offsets_for_info (const_tree desc_type, tree *data_off, void gfc_init_descriptor_variable (stmtblock_t *block, gfc_symbol *sym, tree descr); void gfc_init_descriptor_result (stmtblock_t *block, tree descr); +tree gfc_build_default_class_descriptor (const gfc_typespec &, tree); void gfc_nullify_descriptor (stmtblock_t *block, gfc_symbol *, gfc_expr *, tree, tree); +void gfc_nullify_descriptor (stmtblock_t *block, gfc_expr *, tree); void gfc_init_static_descriptor (tree descr); void gfc_init_absent_descriptor (stmtblock_t *block, tree descr); void gfc_set_scalar_descriptor (stmtblock_t *, tree, tree); void gfc_conv_shift_descriptor_lbound (stmtblock_t *, tree, int, tree); void gfc_conv_shift_descriptor (stmtblock_t *, tree, int); void gfc_conv_shift_descriptor (stmtblock_t *, tree, const gfc_array_ref &); +/* Build a null array descriptor constructor. */ +void gfc_nullify_descriptor (stmtblock_t *block, tree); #endif /* GFC_TRANS_DESCRIPTOR_H */ diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index b67505389659..35f2ae28be90 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -11060,7 +11060,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) if (expr2->expr_type == EXPR_NULL) { /* Just set the data pointer to null. */ - gfc_conv_descriptor_data_set (&lse.pre, lse.expr, null_pointer_node); + gfc_nullify_descriptor (&lse.pre, lse.expr); } else if (rank_remap) {