https://gcc.gnu.org/g:c83d5cb500c627c4c6c8a2438679a65f93dc40fb

commit c83d5cb500c627c4c6c8a2438679a65f93dc40fb
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Wed Aug 13 22:38:03 2025 +0200

    Correction pr43808

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 7e6b0f136104..b41470050cb1 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -1230,11 +1230,11 @@ shift_dimension_bounds (stmtblock_t * block, tree 
descr, tree dim,
   tree ubound = fold_build2_loc (input_location, PLUS_EXPR,
                                 gfc_array_index_type, orig_ubound, diff);
   gfc_conv_descriptor_ubound_set (block, descr, dim, ubound);
-  tree offs_diff = fold_build2_loc (input_location, MULT_EXPR,
-                                   gfc_array_index_type, diff, orig_stride);
+  tree tmp = fold_build2_loc (input_location, MULT_EXPR,
+                             gfc_array_index_type, new_lbound, orig_stride);
   tree off = fold_build2_loc (input_location, MINUS_EXPR,
                              gfc_array_index_type, *offset_value,
-                             offs_diff);
+                             tmp);
   *offset_value = gfc_evaluate_now (off, block);
 
   /* Finally set lbound to value we want.  */

Reply via email to