https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78392
Bug ID: 78392 Summary: ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: janus at gcc dot gnu.org Target Milestone: --- Consider this short test case: module mytypes implicit none contains pure integer function get_i () get_i = 13 end function end module program test use mytypes implicit none integer, dimension(get_i()), save :: x print *, size (x) end It seems to be valid Fortran, but generates an ICE with every gfortran version I tried (from 4.7 to to 7-trunk). On trunk, the error looks like this: internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979 0x8dff23 gfc_trans_auto_array_allocation(tree_node*, gfc_symbol*, gfc_wrapped_block*) /home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-array.c:5979 0x90494d gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*) /home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-decl.c:4321 0x90b66e gfc_generate_function_code(gfc_namespace*) /home/jweil/gcc/gcc7/trunk/gcc/fortran/trans-decl.c:6366 0x8cdcfd gfc_generate_code(gfc_namespace*) /home/jweil/gcc/gcc7/trunk/gcc/fortran/trans.c:2030 0x85cefd translate_all_program_units /home/jweil/gcc/gcc7/trunk/gcc/fortran/parse.c:6038 0x85d572 gfc_parse_file() /home/jweil/gcc/gcc7/trunk/gcc/fortran/parse.c:6238 0x8b66a5 gfc_be_parse_file /home/jweil/gcc/gcc7/trunk/gcc/fortran/f95-lang.c:202 It is related to typebound_proc_19.f90 in the testsuite (from PR 47399).