http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49278
--- Comment #2 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-06-03 18:10:40 UTC --- On Fri, Jun 03, 2011 at 04:08:05PM +0000, kargl at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49278 > > Reduced testcase. > > module oad_active > implicit none > type active > sequence > real :: v > real :: d =0. > end type > end module > > module tots_c > use oad_active > implicit none > type(active), save :: trlkold > data trlkold%v /0./ > end module > This simply patch fixes the segfault with the compiler. Index: trans-expr.c =================================================================== --- trans-expr.c (revision 174566) +++ trans-expr.c (working copy) @@ -4638,7 +4638,7 @@ gfc_conv_structure (gfc_se * se, gfc_exp cm = expr->ts.u.derived->components; for (c = gfc_constructor_first (expr->value.constructor); - c; c = gfc_constructor_next (c), cm = cm->next) + c && cm; c = gfc_constructor_next (c), cm = cm->next) { /* Skip absent members in default initializers and allocatable components. Although the latter have a default initializer It's not clear if it achieves the desired result. The following aborts. Note sure if it is conforming. module oad_active implicit none type active integer :: v integer :: d = 42 end type end module module tots_c use oad_active implicit none type(active), save :: trlkold data trlkold%v /100/ end module program foo use tots_c implicit none if (trlkold%d /= 42) call abort if (trlkold%v /= 100) call abort end program foo