[Bug fortran/52968] [OOP] Call to type-bound procedure produces wrongly rejected
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 13 13:33:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52968
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
Summary|Call to type-bound |[OOP] Call to type-bound
|procedure produces wrongly |procedure produces wrongly
|rejected |rejected
--- Comment #2 from janus at gcc dot gnu.org 2012-04-13 13:32:00 UTC ---
(In reply to comment #1)
> Next, one tries to match "% Evaluate" as type-bound procedure:
>
> if (sym->f2k_derived)
> tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus);
>
> However, the class container does not have f2k_derived - only the "_data"
> component has.
Right. The class container's f2k_derived should be set up in
'gfc_build_class_symbol'. However, this is called before the type
'EquationTemplate' is available, and setting up the f2k_derived fails for this
reason.
Patch:
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 186413)
+++ gcc/fortran/class.c (working copy)
@@ -541,8 +541,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
fclass->refs++;
fclass->ts.type = BT_UNKNOWN;
fclass->attr.abstract = ts->u.derived->attr.abstract;
- if (ts->u.derived->f2k_derived)
- fclass->f2k_derived = gfc_get_namespace (NULL, 0);
+ fclass->f2k_derived = gfc_get_namespace (NULL, 0);
if (gfc_add_flavor (&fclass->attr, FL_DERIVED,
NULL, &gfc_current_locus) == FAILURE)
return FAILURE;
This makes the test case compile correctly (and is free of testsuite
regressions).
More information about the Gcc-bugs
mailing list