------- Comment #2 from janus at gcc dot gnu dot org 2010-06-08 02:32 ------- Ok, this one took me a while to figure out, but in the end it turns out the fix is actually pretty simple, once you found out where the problem is:
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 160351) +++ gcc/fortran/resolve.c (working copy) @@ -5415,6 +5415,9 @@ resolve_typebound_function (gfc_expr* e) if (st == NULL) return resolve_compcall (e, NULL); + if (resolve_ref (e) == FAILURE) + return FAILURE; + /* Get the CLASS declared type. */ declared = get_declared_from_expr (&class_ref, &new_ref, e); @@ -5487,6 +5490,9 @@ resolve_typebound_subroutine (gfc_code *code) if (st == NULL) return resolve_typebound_call (code, NULL); + if (resolve_ref (code->expr1) == FAILURE) + return FAILURE; + /* Get the CLASS declared type. */ declared = get_declared_from_expr (&class_ref, &new_ref, code->expr1); One can construct a test case analogous to comment #0 using a type-bound function, which would also fail. The patch above fixes both flavors. -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2010-05-20 19:01:47 |2010-06-08 02:32:39 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44211