https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71936
Bug ID: 71936 Summary: ICE in wide_int_to_tree, at tree.c:1487 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gerhard.steinmetz.fort...@t-online.de Target Milestone: --- Looking at "class" and 4 combinations allocatable|pointer, the following cases give an ICE with gfortran 7 and 6 (not with 5, 4.9, 4.8). $ cat z1.f90 program p type t end type class(t), allocatable :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() class(t), allocatable :: f(:) ! delivers no data end end $ cat z2.f90 program p type t end type class(t), allocatable :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() class(t), pointer :: f(:) end end $ gfortran-5 z1.f90 z1.f90:5:13: allocate (x, mold=f()) 1 Error: Array specification required in ALLOCATE statement at (1) z1.f90:7:13: allocate (x, source=f()) 1 Error: Array specification required in ALLOCATE statement at (1) $ $ gfortran-7-20160717 z1.f90 z1.f90:5:0: allocate (x, mold=f()) internal compiler error: in wide_int_to_tree, at tree.c:1487 0xeb3f53 wide_int_to_tree(tree_node*, generic_wide_int<wide_int_ref_storage<false> > const&) ../../gcc/tree.c:1487 0xeb41d6 build_int_cst(tree_node*, long) ../../gcc/tree.c:1295 0x71f88b gfc_allocate_allocatable(stmtblock_t*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, gfc_expr*) ../../gcc/fortran/trans.c:794 0x7a013e gfc_trans_allocate(gfc_code*) ../../gcc/fortran/trans-stmt.c:5876 0x71c407 trans_code ../../gcc/fortran/trans.c:1838 0x74b218 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6207 0x6d6cc0 translate_all_program_units ../../gcc/fortran/parse.c:5916 0x6d6cc0 gfc_parse_file() ../../gcc/fortran/parse.c:6122 0x719192 gfc_be_parse_file ../../gcc/fortran/f95-lang.c:198