https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77678
Bug ID: 77678 Summary: ICE in fold_read_from_constant_string, at fold-const.c:13706 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: --- A problem with default initialization (used for testing only), starting at a specific negative value. For versions down to at least 4.8, at -Og, -Os, -O1 or higher. Testcode with an uninitialized variable "i" : $ cat z1.f90 program p character(1) :: z integer :: i ! i = 2 z = 'abc'(i:i) print *, z end $ gfortran-7-20160918 -O2 -finit-integer=-1 z1.f90 $ gfortran-7-20160918 -O2 -finit-integer=-8900000 z1.f90 $ gfortran-7-20160918 -O2 -finit-integer=-12345678 z1.f90 z1.f90:7:0: end internal compiler error: Segmentation fault 0xc21a5f crash_signal ../../gcc/toplev.c:336 0x951f1b fold_read_from_constant_string(tree_node*) ../../gcc/fold-const.c:13706 0x996f7f fold_const_aggregate_ref_1(tree_node*, tree_node* (*)(tree_node*)) ../../gcc/gimple-fold.c:5754 0x9984de fold_const_aggregate_ref(tree_node*) ../../gcc/gimple-fold.c:5857 0x9984de maybe_fold_reference ../../gcc/gimple-fold.c:281 0x998999 fold_gimple_assign ../../gcc/gimple-fold.c:313 0x99ddff fold_stmt_1 ../../gcc/gimple-fold.c:3901 0xdc0781 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*) ../../gcc/tree-ssa-propagate.c:1111 0x1299da2 dom_walker::walk(basic_block_def*) ../../gcc/domwalk.c:265 0xdbfb9b substitute_and_fold(tree_node* (*)(tree_node*), bool (*)(gimple_stmt_iterator*), bool) ../../gcc/tree-ssa-propagate.c:1211 0xd299cc ccp_finalize ../../gcc/tree-ssa-ccp.c:949 0xd299cc do_ssa_ccp ../../gcc/tree-ssa-ccp.c:2415 0xd299cc execute ../../gcc/tree-ssa-ccp.c:2458