http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53643
Bug #: 53643 Summary: [OOP] ICE (segfault) with INTENT(OUT) CLASS array Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org CC: fanfarillo....@gmail.com Found by Alessandro Fanfarillo and me, cf. http://gcc.gnu.org/ml/fortran/2012-06/msg00070.html The following program gives an ICE (segfault) type t integer, allocatable :: comp end type t contains subroutine foo(x) class(t), allocatable, intent(out) :: x(:) end subroutine end Untested draft patch: --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3453,8 +3453,3 @@ init_intent_out_dt (gfc_symbol * proc_sym, { - tree decl = build_fold_indirect_ref_loc (input_location, - f->sym->backend_decl); - tmp = CLASS_DATA (f->sym)->backend_decl; - tmp = fold_build3_loc (input_location, COMPONENT_REF, - TREE_TYPE (tmp), decl, tmp, NULL_TREE); - tmp = build_fold_indirect_ref_loc (input_location, tmp); + tmp = gfc_class_data_get (f->sym->backend_decl); tmp = gfc_deallocate_alloc_comp (CLASS_DATA (f->sym)->ts.u.derived,