https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72698
Bug ID: 72698 Summary: ICE in lhd_incomplete_type_error, at langhooks.c:205 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: --- ICE with 7, 6, 5 (bailout with official releases). Working with 4.9 and 4.8. Valid code with a zero-length input string : $ cat z1.f90 module m contains integer function f() f = 4 end end program p use m character(3), parameter :: c = 'abc' character(:), allocatable :: z allocate (z, source=repeat(c(2:1), f())) print *, len(z), ' >>' // z // '<<' end $ cat z2.f90 program p character(3), parameter :: c = 'abc' character(:), allocatable :: z allocate (z, source=repeat(c(2:1), 4)) print *, len(z), ' >>' // z // '<<' end $ gfortran-7-20160724 z1.f90 z1.f90:11:0: allocate (z, source=repeat(c(2:1), f())) Error: size of variable 'source.3' is too large z1.f90:11:0: allocate (z, source=repeat(c(2:1), f())) internal compiler error: in lhd_incomplete_type_error, at langhooks.c:205 0xa8d51f lhd_incomplete_type_error(unsigned int, tree_node const*, tree_node const*) ../../gcc/langhooks.c:205 0xea02da size_in_bytes_loc(unsigned int, tree_node const*) ../../gcc/tree.c:2953 0x909ed4 expr_size(tree_node*) ../../gcc/expr.c:11762 0x90a27d store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool, tree_node*) ../../gcc/expr.c:5610 0x90bad7 expand_assignment(tree_node*, tree_node*, bool) ../../gcc/expr.c:5168 0x7fc726 expand_gimple_stmt_1 ../../gcc/cfgexpand.c:3650 0x7fc726 expand_gimple_stmt ../../gcc/cfgexpand.c:3746 0x7feb3e expand_gimple_basic_block ../../gcc/cfgexpand.c:5753 0x804cd6 execute ../../gcc/cfgexpand.c:6368