[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression allocate_with_source_11
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 13 15:06:06 GMT 2025
https://gcc.gnu.org/g:b1c7ede9ab6a13b2f6d51bf123e97d3330eeb852
commit b1c7ede9ab6a13b2f6d51bf123e97d3330eeb852
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Sun May 18 15:37:02 2025 +0200
Correction régression allocate_with_source_11
Diff:
---
gcc/fortran/trans-expr.cc | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 255ed2711da5..c4ab6a2ef772 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -1318,10 +1318,23 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
}
else
{
- if (TREE_TYPE (parmse->expr) != TREE_TYPE (ctree))
- parmse->expr = fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
- TREE_TYPE (ctree), parmse->expr);
- gfc_add_modify (&block, ctree, parmse->expr);
+ tree val = parmse->expr;
+
+ if (TREE_CODE (TREE_TYPE (val)) == POINTER_TYPE)
+ val = build_fold_indirect_ref_loc (input_location, val);
+
+ if (GFC_CLASS_TYPE_P (TREE_TYPE (val)))
+ val = gfc_class_data_get (val);
+
+ if (TREE_CODE (TREE_TYPE (ctree)) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (val)) != POINTER_TYPE)
+ val = gfc_build_addr_expr (NULL_TREE, val);
+
+ if (TREE_TYPE (val) != TREE_TYPE (ctree))
+ val = fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
+ TREE_TYPE (ctree), val);
+
+ gfc_add_modify (&block, ctree, val);
}
/* Return the data component, except in the case of scalarized array
More information about the Gcc-cvs
mailing list