------- Comment #16 from fxcoudert at gcc dot gnu dot org 2007-11-10 00:53 ------- The following patch clears part of the problem, for example the following testcase:
module g interface i module procedure sint => sreal end interface i end module g More is needed, but I'm stuck. I've used valgrind, and I think we don't recover well after gfc_match_modproc() exiting with MATCH_ERROR. Index: decl.c =================================================================== --- decl.c (revision 129869) +++ decl.c (working copy) @@ -5862,12 +5862,23 @@ gfc_match_modproc (void) for (;;) { + bool last = false; + m = gfc_match_name (name); if (m == MATCH_NO) goto syntax; if (m != MATCH_YES) return MATCH_ERROR; + /* Check for syntax error before starting to add symbols to the + current namespace. */ + if (gfc_match_eos () == MATCH_YES) + last = true; + if (!last && gfc_match_char (',') != MATCH_YES) + goto syntax; + + /* Now we're sure the syntax is valid, we process this item + further. */ if (gfc_get_symbol (name, module_ns, &sym)) return MATCH_ERROR; @@ -5881,10 +5892,8 @@ gfc_match_modproc (void) sym->attr.mod_proc = 1; - if (gfc_match_eos () == MATCH_YES) + if (last) break; - if (gfc_match_char (',') != MATCH_YES) - goto syntax; } return MATCH_YES; -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu dot | |org Last reconfirmed|2007-11-02 13:18:42 |2007-11-10 00:53:08 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25252