summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index b6acca3a5f1..533246d0c8d 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -2356,14 +2356,10 @@ mio_component_ref (gfc_component **cp, gfc_symbol *sym)
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;
-
- if (q == NULL)
- gfc_internal_error ("mio_component_ref(): Component not found");
+ q = gfc_find_component (sym, name, true, true);
- associate_integer_pointer (p, q);
+ if (q)
+ associate_integer_pointer (p, q);
}
/* Make sure this symbol will eventually be loaded. */