http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48786
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-30 10:04:59 UTC --- (In reply to comment #3) > If one modifies the program (cf. attachment 24110 [details]) as follows, > gfortran 4.7 segfaults The reason is that in gfc_type_compatible, the ts1 and ts2 are both BT_CLASS, with ts1->u.derived->name == point3d and ts2->u.derived->name == point2d As point3d is derived from point2d, the first component is the parent type: ts1->u.derived->components->name == point2d while point2d is not derived and thus the first component is the "real :: x" component: ts2->u.derived->components->name == x Thus, it is not surprising that accessing "x"'s ts.u.derived is NULL: ts2->u.derived->components->ts.u.derived gfc_type_compatible is called via gfc_compare_types, which is called by resolve.c's check_typebound_override if (!gfc_compare_types (&proc_target->result->ts, &old_target->result->ts)) * * * > Regarding a second program at > http://gcc.gnu.org/ml/fortran/2011-04/msg00302.html (see example 2 > attachment): Draft patch at: http://gcc.gnu.org/ml/fortran/2011-04/msg00318.html