http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47601
--- Comment #23 from janus at gcc dot gnu.org 2011-05-28 17:47:39 UTC ---
(In reply to comment #22)
> [macbook] f90/bug% gfc
> /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_12.f90
> f951: internal compiler error: Segmentation fault
Thanks for checking, Dominique. Here is an updated patch:
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (revision 174380)
+++ gcc/fortran/module.c (working copy)
@@ -2356,14 +2356,10 @@ 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, true, true);
- if (q == NULL)
- gfc_internal_error ("mio_component_ref(): Component not found");
-
- associate_integer_pointer (p, q);
+ if (q)
+ associate_integer_pointer (p, q);
}
/* Make sure this symbol will eventually be loaded. */
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 174380)
+++ gcc/fortran/symbol.c (working copy)
@@ -1996,7 +1996,7 @@ gfc_find_component (gfc_symbol *sym, const char *n
{
gfc_component *p;
- if (name == NULL)
+ if (name == NULL || sym == NULL)
return NULL;
sym = gfc_use_derived (sym);