http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47601
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 |
--- Comment #17 from janus at gcc dot gnu.org 2011-05-28 13:43:23 UTC ---
(In reply to comment #16)
> Janus, you know type extension better than me. Does one now needs to do:
> if (!p && sym->attr.extension)
> {
> p = search (sym->components->ts.u.derived)
> if (!p && sym->components->ts.u.derived->attr.extension)
> p = search (sym->components->ts.u.derived->...)
>
> or is this the wrong method?
Yes, sounds good. Also that's exactly what 'gfc_find_component' does, so I'd
propose the following patch:
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (revision 174030)
+++ gcc/fortran/module.c (working copy)
@@ -2356,9 +2356,7 @@ mio_component_ref (gfc_component **cp, gfc_symbol
if (sym->components != NULL && p->u.pointer == NULL)
{
/* Symbol already loaded, so search by name. */
- for (q = sym->components; q; q = q->next)
- if (strcmp (q->name, name) == 0)
- break;
+ q = gfc_find_component (sym, name, false, false);
if (q == NULL)
gfc_internal_error ("mio_component_ref(): Component not found");
This fixes the test case, but is not regtested.