https://gcc.gnu.org/g:480a6c07dc80604899315779877d640b815c6ea3

commit 480a6c07dc80604899315779877d640b815c6ea3
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Mon May 19 21:02:06 2025 +0200

    Correction régression dec_type_print_2

Diff:
---
 gcc/fortran/trans-array.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index f9bdcd395eba..d8d7aa9b97c1 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8935,7 +8935,12 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, 
tree dest,
          tmp = array_type_nelts_minus_one (decl_type);
          if (error_operand_p (tmp)
              && GFC_ARRAY_TYPE_P (decl_type))
-           tmp = GFC_TYPE_ARRAY_SIZE (decl_type);
+           {
+             tmp = GFC_TYPE_ARRAY_SIZE (decl_type);
+             tmp = fold_build2_loc (input_location, MINUS_EXPR,
+                                    gfc_array_index_type, tmp,
+                                    gfc_index_one_node);
+           }
          tmp = fold_convert (gfc_array_index_type, tmp);
        }

Reply via email to