http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53306
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-05-10 CC| |burnus at gcc dot gnu.org Target Milestone|--- |4.6.4 Summary|ICE on invalid 'array(*) =' |[4.6/4.7/4.8 Regression] |statement |ICE on invalid 'array(*) =' | |statement Ever Confirmed|0 |1 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-10 13:23:26 UTC --- Confirmed. The problem is in resolve.c's 4573 resolve_array_ref (gfc_array_ref *ar) 4574 { ... 4578 for (i = 0; i < ar->dimen + ar->codimen; i++) 4579 { ... 4592 e = ar->start[i]; ... 4594 if (ar->dimen_type[i] == DIMEN_UNKNOWN) 4595 switch (e->rank) The problem is that "e" alias ar->start[0] is NULL. GCC < 4.6 prints: a(*) = 8 1 Error: Expected array subscript at (1) I think it either has to do with Coarrays or with the support of "..., parameter :: A(*) = [1, 2, 3]". I think something goes wrong with the logic at if (m == MATCH_NO && gfc_match_char ('*') == MATCH_YES) return MATCH_NO; else if (m == MATCH_NO) gfc_error ("Expected array subscript at %C"); in match_subscript (gfc_array_ref *ar, int init, bool match_star) Maybe a "&& match_star" is missing in the "if" condition? Untested patch: --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -94,3 +94,3 @@ match_subscript (gfc_array_ref *ar, int init, bool match_star) - if (m == MATCH_NO && gfc_match_char ('*') == MATCH_YES) + if (m == MATCH_NO && match_star && gfc_match_char ('*') == MATCH_YES) return MATCH_NO;