[Bug fortran/71203] ICE in add_init_expr_to_sym, at fortran/decl.c:1512 and :1564

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Wed Mar 6 22:28:00 GMT 2019


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

--- Comment #13 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The integer parts in comment#1 need further debugging.
> If somebody finds a related PR, this one might be closed as duplicate.

With the following patch

--- ../_clean/gcc/fortran/decl.c        2019-02-23 13:43:24.000000000 +0100
+++ gcc/fortran/decl.c  2019-03-06 23:24:56.000000000 +0100
@@ -1984,7 +1984,12 @@ add_init_expr_to_sym (const char *name, 
            }

          /* Shape should be present, we get an initialization expression.  */
-         gcc_assert (init->shape);
+         if (!init->shape)
+           {
+             gfc_error ("Can't initialize array with unknown shape at %L",
+                        &sym->declared_at);
+             return false;
+           }

          for (dim = 0; dim < sym->as->rank; ++dim)
            {

I get errors such as

% gfc pr71203_3.f90
pr71203_3.f90:4:29:

    4 |    integer, parameter :: y(*) = [(x(i:i), i=1,2)]
      |                             1
Error: Can't initialize array with unknown shape at (1)


More information about the Gcc-bugs mailing list