[Bug fortran/54195] [4.8 Regression][OOP] IMPORT fails with GENERIC TBP: "is already present in the interface"
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Feb 2 11:07:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54195
--- Comment #13 from Mikael Morin <mikael at gcc dot gnu.org> 2013-02-02 11:07:30 UTC ---
(In reply to comment #12)
> (In reply to comment #11)
> > The `gfc_namespace' struct has a `resolved' attribute. Maybe we can use it?
>
> Not sure. I was thinking that we may need such an attribute for each type
> symbol ("gfc_symbol.resolved"?). See e.g. PR 44978 for a related problem.
It is actually not as trivial as it looks. In PR44978, the recursion on the
parent type is in resolve_fl_derived0. So the flag should be used there.
However, in this bug the recursion on the parent type is in
resolve_typebound_procedures, so the same flag can't be used for both. The
latter recursion can be made through resolve_fl_derived, or even through
resolve_symbol (see patch below), but it would keep the recursion in
resolve_fl_derived0 untouched, hence PR44978 unfixed. To fix both, there
should be almost one flag per function, and one should cache the return values
as well. :-(
So the easiest IMO is the following:
This fixes PR54107 comment 26:
diff --git a/gfortran.h b/gfortran.h
index 16751b4..f93e4d3 100644
--- a/gfortran.h
+++ b/gfortran.h
@@ -696,6 +696,9 @@ extern const ext_attr_t ext_attr_list[];
/* Symbol attribute structure. */
typedef struct
{
+ gfc_try resolve_cached_result;
+ unsigned resolved:1;
+
/* Variable attributes. */
unsigned allocatable:1, dimension:1, codimension:1, external:1, intrinsic:1,
optional:1, pointer:1, target:1, value:1, volatile_:1, temporary:1,
diff --git a/resolve.c b/resolve.c
index d6bae43..ef06f4e 100644
--- a/resolve.c
+++ b/resolve.c
@@ -13170,6 +13170,10 @@ resolve_symbol (gfc_symbol *sym)
gfc_array_spec *as;
bool saved_specification_expr;
+ if (sym->attr.resolved)
+ return;
+ sym->attr.resolved = 1;
+
if (sym->attr.artificial)
return;
and then, with this:
diff --git a/resolve.c b/resolve.c
index d6bae43..ef06f4e 100644
--- a/resolve.c
+++ b/resolve.c
@@ -12349,7 +12349,7 @@ resolve_typebound_procedures (gfc_symbol* derived)
super_type = gfc_get_derived_super_type (derived);
if (super_type)
- resolve_typebound_procedures (super_type);
+ resolve_symbol (super_type);
resolve_bindings_derived = derived;
resolve_bindings_result = SUCCESS;
comment #8 of this bug is fixed as well. I'm inclined to test and submit both,
and leave PR44978 unfixed.
More information about the Gcc-bugs
mailing list