https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67044
Bug ID: 67044 Summary: ICE on valid code Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mrestelli at gmail dot com Target Milestone: --- I see and ICE with the attached code. $ gfortran -c ice.f90 ice.f90:44:0: allocate( z%f , source=unpck(x)+unpck(y) ) ^ internal compiler error: in aggregate_value_p, bei function.c:2052 0x819313 aggregate_value_p(tree_node const*, tree_node const*) gcc/function.c:2052 0x6fa71a expand_call(tree_node*, rtx_def*, int) gcc/calls.c:2578 0x7dc16a expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) gcc/expr.c:10362 0x7e55c6 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, tree_node*) gcc/expr.c:5398 0x7e6aec expand_assignment(tree_node*, tree_node*, bool) gcc/expr.c:5170 0x709486 expand_call_stmt gcc/cfgexpand.c:2350 0x709486 expand_gimple_stmt_1 gcc/cfgexpand.c:3239 0x709486 expand_gimple_stmt gcc/cfgexpand.c:3400 0x70aa91 expand_gimple_basic_block gcc/cfgexpand.c:5412 0x70ef06 execute gcc/cfgexpand.c:6023 $ gfortran --version GNU Fortran (GCC) 6.0.0 20150727 (experimental) (I see the same problem with versions 5.1.0 and 4.9.2) module m implicit none public :: t_base, unpck private type, abstract :: t_base contains private generic, public :: operator(+) => add procedure(i_add), pass(x), deferred :: add end type t_base type, extends(t_base) :: t_cont class(t_base), allocatable :: f contains procedure, pass(x) :: add => cont_add end type t_cont abstract interface elemental function i_add(x,y) result(z) import :: t_base, t_cont implicit none class(t_base), intent(in) :: x, y type(t_cont) :: z end function i_add end interface contains pure recursive function unpck(x) result(y) class(t_base), intent(in) :: x class(t_base), allocatable :: y end function unpck elemental function cont_add(x,y) result(z) class(t_cont), intent(in) :: x class(t_base), intent(in) :: y type(t_cont) :: z allocate( z%f , source=unpck(x)+unpck(y) ) end function cont_add end module m