https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59016
--- Comment #18 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- With an additional filtering on (m == MATCH_ERROR), i.e. with the following patch, the ICEs are fixed without regression --- ../_clean/gcc/fortran/decl.c 2015-03-25 14:07:04.000000000 +0100 +++ gcc/fortran/decl.c 2015-04-05 16:17:34.000000000 +0200 @@ -4427,6 +4437,32 @@ ok: gfc_free_data_all (gfc_current_ns); cleanup: + //<pr59016> in gfc_match_data_decl; cleanup the garbages + gfc_symbol *csym = NULL; + if ((m == MATCH_ERROR) && current_ts.u.derived + && current_ts.u.derived->name) + { + char iname[129]; + iname[128] = 0; + for (int i = 0; i < 128; i++) + { + iname[i] = current_ts.u.derived->name[i]; + if (current_ts.u.derived->name[i] == 0) + break; + } + iname[0] = TOLOWER(iname[0]); + for (int i = 0; i < 4; i++) + { + gfc_find_symbol (iname, NULL, i, &csym) ; + if (csym && csym->generic + && (csym->generic->sym == current_ts.u.derived)) + { + csym->generic = NULL; + break; + } + } + } + //</pr59016> gfc_free_array_spec (current_as); current_as = NULL; return m; Further testing in progress. A few comments: (1) The patch could probably be simplified, (2) Its conformity with the GNU coding style has to be checked. (3) It has to go to fort...@gcc.gnu.org and gcc-patc...@gcc.gnu.org for review.