[Bug fortran/53643] New: [OOP] ICE (segfault) with INTENT(OUT) CLASS array

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 12 08:43:00 GMT 2012


             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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: fanfarillo.gcc@gmail.com

Found by Alessandro Fanfarillo and me, cf.

The following program gives an ICE (segfault)

type t
  integer, allocatable :: comp
end type t
  subroutine foo(x)
    class(t), allocatable, intent(out) :: x(:)
  end subroutine

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,

More information about the Gcc-bugs mailing list