[Bug fortran/95372] ICE in find_array_section, at fortran/expr.c:1687

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 5 16:18:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95372

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-05
                 CC|                            |kargl at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #1 from kargl at gcc dot gnu.org ---
This allows the code to compile and print 1.

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 280157)
+++ gcc/fortran/expr.c  (working copy)
@@ -1684,7 +1684,13 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
        }

       cons = gfc_constructor_lookup (base, limit);
-      gcc_assert (cons);
+
+      if (!cons)
+       {
+         t = false;
+         goto cleanup;
+       }
+
       gfc_constructor_append_expr (&expr->value.constructor,
                                   gfc_copy_expr (cons->expr), NULL);
     }


More information about the Gcc-bugs mailing list