This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/59910] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:5327
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Apr 2017 13:48:20 +0000
- Subject: [Bug fortran/59910] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:5327
- Auto-submitted: auto-generated
- References: <bug-59910-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59910
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > It does for me provided the patch is applied at the proper location:
> >
> > @@ -2657,6 +2657,12 @@ gfc_match_structure_constructor (gfc_sym
> >
> > Applying the patch with patch -p0 -i patch-59910 put the fix in the wrong
> > location
> >
> > @@ -245,6 +245,12 @@ match_integer_constant (gfc_expr **resul
> >
> > Regtesting in progress. Any objection if I do the back port?
>
> This is a little confusing. The original patch is in
> gfc_match_structure_constructor (). Is your new patch still in this function
> for 5 or in a different function? Maybe post your clean diff
> so we can understand better. Is the original patch in the wrong place?
Applying the patch
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c (revision 230497)
+++ gcc/fortran/primary.c (working copy)
@@ -2722,6 +2722,12 @@ gfc_match_structure_constructor (gfc_sym
return MATCH_ERROR;
}
+ /* If a structure constructor is in a DATA statement, then each entity
+ in the structure constructor must be a constant. Try to reduce the
+ expression here. */
+ if (gfc_in_match_data ())
+ gfc_reduce_init_expr (e);
+
*result = e;
return MATCH_YES;
}
to the gcc5 branch located it at
@@ -245,6 +245,12 @@ match_integer_constant (gfc_expr **resul
Indeed this is surprising, but don't ask me what went wrong.
The correct patch for gcc5 is
--- ../5_clean/gcc/fortran/primary.c 2016-03-24 09:51:26.000000000 +0100
+++ ../5_work/gcc/fortran/primary.c 2017-04-12 16:29:52.000000000 +0200
@@ -2657,6 +2657,12 @@ gfc_match_structure_constructor (gfc_sym
return MATCH_ERROR;
}
+ /* If a structure constructor is in a DATA statement, then each entity
+ in the structure constructor must be a constant. Try to reduce the
+ expression here. */
+ if (gfc_in_match_data ())
+ gfc_reduce_init_expr (e);
+
*result = e;
return MATCH_YES;
}
which applies cleanly.