https://gcc.gnu.org/g:057f0c6bab0e61a522a894a0bfe618e345c9d1ab

commit 057f0c6bab0e61a522a894a0bfe618e345c9d1ab
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 3582837e77e4..f285f4550088 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8164,22 +8164,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