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

--- Comment #12 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #11)
> Slightly different variant of z3.f90, with a different ICE:
> 
> program p
>    real :: a(2,2)[*]
>    data a /1.0, 2.0, 3.0, 4.0/
> end
> 
> Interner Compiler-Fehler: Speicherzugriffsfehler
> 0xe24dff crash_signal
>         ../../trunk/gcc/toplev.c:326
> 0x986688 gfc_get_nodesc_array_type(tree_node*, gfc_array_spec*, gfc_packed,
> bool)
>         ../../trunk/gcc/fortran/trans-types.c:1617
> 0x90822b gfc_build_constant_array_constructor(gfc_expr*, tree_node*)
>         ../../trunk/gcc/fortran/trans-array.c:2267
> 0x945fd4 gfc_trans_array_constructor_copy
>         ../../trunk/gcc/fortran/trans-expr.c:9913
> 0x945fd4 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool, bool, bool)
>         ../../trunk/gcc/fortran/trans-expr.c:10891

This particular case can be fixes (well, sort of) with

Index: trans-decl.c
===================================================================
--- trans-decl.c        (Revision 268432)
+++ trans-decl.c        (Arbeitskopie)
@@ -5399,6 +5399,12 @@
   /* Handle "static" initializer.  */
   if (sym->value)
     {
+      /* An EXPR_ARRAY with a rank > 1 here has to come from a DATA
+        statement.  Set its rank here as not to confuse the following
+        steps.  See PR 71066.  */
+      if (sym->value->expr_type == EXPR_ARRAY)
+       sym->value->rank = 1;
+
       sym->attr.pointer = 1;
       tmp = gfc_trans_assignment (gfc_lval_expr_from_sym (sym), sym->value,
                                  true, false);

but z3.f90 still ICEs.

Reply via email to