https://gcc.gnu.org/g:44519311eb6d94538dc1224ab6276a52847b90df

commit 44519311eb6d94538dc1224ab6276a52847b90df
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Tue Jul 1 22:20:34 2025 +0200

    Ajout locations setters

Diff:
---
 gcc/fortran/trans-descriptor.cc | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 20484abd39a0..e5f0076ab855 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -218,10 +218,10 @@ gfc_conv_descriptor_data_get (tree desc)
   tree type = TREE_TYPE (desc);
   gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
 
+  location_t loc = input_location;
   tree field = get_descriptor_data (desc);
   tree target_type = GFC_TYPE_ARRAY_DATAPTR_TYPE (TREE_TYPE (desc));
-  tree t = fold_convert (target_type, field);
-  return non_lvalue_loc (input_location, t);
+  return non_lvalue_loc (loc, fold_convert_loc (loc, target_type, field));
 }
 
 /* This provides WRITE access to the data field.
@@ -235,8 +235,10 @@ gfc_conv_descriptor_data_get (tree desc)
 void
 gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
 {
+  location_t loc = input_location;
   tree field = get_descriptor_data (desc);
-  gfc_add_modify (block, field, fold_convert (TREE_TYPE (field), value));
+  gfc_add_modify_loc (loc, block, field,
+                     fold_convert_loc (loc, TREE_TYPE (field), value));
 }
 
 
@@ -255,8 +257,10 @@ gfc_conv_descriptor_offset_get (tree desc)
 void
 gfc_conv_descriptor_offset_set (stmtblock_t *block, tree desc, tree value)
 {
+  location_t loc = input_location;
   tree t = get_descriptor_offset (desc);
-  gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+  gfc_add_modify_loc (loc, block, t,
+                     fold_convert_loc (loc, TREE_TYPE (t), value));
 }
 
 
@@ -297,8 +301,10 @@ gfc_conv_descriptor_span_get (tree desc)
 void
 gfc_conv_descriptor_span_set (stmtblock_t *block, tree desc, tree value)
 {
+  location_t loc = input_location;
   tree t = gfc_conv_descriptor_span (desc);
-  gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+  gfc_add_modify_loc (loc, block, t,
+                     fold_convert_loc (loc, TREE_TYPE (t), value));
 }
 
 
@@ -543,8 +549,10 @@ void
 gfc_conv_descriptor_stride_set (stmtblock_t *block, tree desc,
                                tree dim, tree value)
 {
+  location_t loc = input_location;
   tree t = get_descriptor_stride (desc, dim);
-  gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+  gfc_add_modify_loc (loc, block, t,
+                     fold_convert_loc (loc, TREE_TYPE (t), value));
 }
 
 static tree
@@ -563,8 +571,10 @@ void
 gfc_conv_descriptor_lbound_set (stmtblock_t *block, tree desc,
                                tree dim, tree value)
 {
+  location_t loc = input_location;
   tree t = get_descriptor_lbound (desc, dim);
-  gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+  gfc_add_modify_loc (loc, block, t,
+                     fold_convert_loc (loc, TREE_TYPE (t), value));
 }
 
 static tree
@@ -583,8 +593,10 @@ void
 gfc_conv_descriptor_ubound_set (stmtblock_t *block, tree desc,
                                tree dim, tree value)
 {
+  location_t loc = input_location;
   tree t = get_descriptor_ubound (desc, dim);
-  gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
+  gfc_add_modify_loc (loc, block, t,
+                     fold_convert_loc (loc, TREE_TYPE (t), value));
 }

Reply via email to