https://gcc.gnu.org/g:5c1e019c73014fe6e7c2654dea03e9cc0b02d891

commit 5c1e019c73014fe6e7c2654dea03e9cc0b02d891
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Fri Feb 14 17:11:03 2025 +0100

    Correction ICE class_to_type_1

Diff:
---
 gcc/fortran/trans-array.cc | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index d085e76a14e3..ef9c5c8dfc16 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8144,22 +8144,24 @@ late_set_loop_bounds (gfc_loopinfo *loop)
 
   for (n = 0; n < loop->dimen; n++)
     {
-      /* We should have found the scalarization loop specifier.  If not,
-        that's bad news.  */
-      gcc_assert (loopspec[n]);
-
-      info = &loopspec[n]->info->data.array;
-      dim = loopspec[n]->dim[n];
-
       /* Set the extents of this range.  */
-      if ((loop->from[n] == NULL_TREE
-          || loop->to[n] == NULL_TREE)
-         && loopspec[n]->info->type == GFC_SS_FUNCTION
-         && info->start[dim]
-         && info->end[dim])
+      if (loop->from[n] == NULL_TREE
+         || loop->to[n] == NULL_TREE)
        {
-         loop->from[n] = info->start[dim];
-         loop->to[n] = info->end[dim];
+         /* We should have found the scalarization loop specifier.  If not,
+            that's bad news.  */
+         gcc_assert (loopspec[n]);
+
+         info = &loopspec[n]->info->data.array;
+         dim = loopspec[n]->dim[n];
+
+         if (loopspec[n]->info->type == GFC_SS_FUNCTION
+             && info->start[dim]
+             && info->end[dim])
+           {
+             loop->from[n] = info->start[dim];
+             loop->to[n] = info->end[dim];
+           }
        }
     }

Reply via email to