https://gcc.gnu.org/g:ad4e4b565a86cffb27142887928b62016a3e7c72
commit ad4e4b565a86cffb27142887928b62016a3e7c72 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Thu Apr 17 17:38:15 2025 +0200 Correction régression pr95827 Diff: --- gcc/fortran/trans-decl.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index af12bf4255e6..aaa0e4af1fce 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -1212,13 +1212,16 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) type = TREE_TYPE (type); } - tree new_type = update_type_bounds (type, lbound, ubound, spacing, type, - as->rank - 1); - if (POINTER_TYPE_P (TREE_TYPE (decl))) - TREE_TYPE (TREE_TYPE (decl)) = new_type; - else - TREE_TYPE (decl) = new_type; - type = new_type; + if (as->rank > 0) + { + tree new_type = update_type_bounds (type, lbound, ubound, spacing, type, + as->rank - 1); + if (POINTER_TYPE_P (TREE_TYPE (decl))) + TREE_TYPE (TREE_TYPE (decl)) = new_type; + else + TREE_TYPE (decl) = new_type; + type = new_type; + } for (dim = GFC_TYPE_ARRAY_RANK (type); dim < GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type); dim++)