https://gcc.gnu.org/g:94b799c5cbc42c0defa4fddeccc6b2f86c2fe7b4

commit 94b799c5cbc42c0defa4fddeccc6b2f86c2fe7b4
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Thu Apr 17 14:38:11 2025 +0200

    Renseignement spacing pour les tableaux constants

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

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 5652eb1c7185..81466a0cde75 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -4579,7 +4579,6 @@ done:
            }
 
          /* FALLTHRU */
-       case GFC_SS_CONSTRUCTOR:
        case GFC_SS_FUNCTION:
          for (n = 0; n < ss->dimen; n++)
            {
@@ -4592,6 +4591,30 @@ done:
            }
          break;
 
+       case GFC_SS_CONSTRUCTOR:
+         {
+           gcc_assert (info->shape != nullptr);
+           tree type = gfc_typenode_for_spec (&ss_info->expr->ts);
+           tree spacing = fold_convert_loc (input_location,
+                                            gfc_array_index_type,
+                                            TYPE_SIZE_UNIT (type));
+           for (n = 0; n < ss->dimen; n++)
+             {
+               int dim = ss->dim[n];
+
+               info->start[dim]  = gfc_index_zero_node;
+               info->end[dim]    = gfc_index_zero_node;
+               info->stride[dim] = gfc_index_one_node;
+               info->spacing[dim] = spacing;
+               tree extent = gfc_conv_mpz_to_tree_type (info->shape[n],
+                                               gfc_array_index_type);
+               spacing = fold_build2_loc (input_location, MULT_EXPR,
+                                          gfc_array_index_type, spacing,
+                                          extent);
+             }
+         }
+         break;
+
        default:
          break;
        }

Reply via email to