http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57445
Bug ID: 57445 Summary: [4.8/4.9 Regression][OOP] ICE in gfc_conv_class_to_class - for OPTIONAL polymorphic array Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Found when working on FINALization. It compiles with GCC 4.7 but fails with GCC 4.8 and 4.9. The following ICEs when passing an optional polymorphic array as argument to an optional dummy argument: finalize_12.f90:12:0: internal compiler error: in gfc_conv_class_to_class, at fortran/trans-expr.c:740 call foo_opt(xca=xca)!, xc, xaa, xca) ^ 0x63c6f9 gfc_conv_class_to_class(gfc_se*, gfc_expr*, gfc_typespec, bool, bool, bool, bool) ../../gcc/fortran/trans-expr.c:740 0x637b72 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc/fortran/trans-expr.c:4423 module m implicit none type t integer :: i end type t contains subroutine opt(xa, xc, xaa, xca) type(t), allocatable, intent(out), optional :: xa class(t), allocatable, intent(out), optional :: xc type(t), allocatable, intent(out), optional :: xaa(:) class(t), allocatable, intent(out), optional :: xca(:) call foo_opt(xca=xca)!, xc, xaa, xca) end subroutine opt subroutine foo_opt(xa, xc, xaa, xca) type(t), allocatable, intent(out), optional :: xa class(t), allocatable, intent(out), optional :: xc type(t), allocatable, intent(out), optional :: xaa(:) class(t), allocatable, intent(out), optional :: xca(:) end subroutine foo_opt end module m