https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67674
Bug ID: 67674 Summary: Incorrect result or ICE for deferred-length character component Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: kristopher.kuhlman at gmail dot com Target Milestone: --- Created attachment 36368 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36368&action=edit test program The attached test case results in incorrect results from trunk version of gfortran (6.0). The same program gives a "not yet supported" message from 4.8.4 and gives an internal compiler error for 4.9.3. Using Ubuntu 14.04. Intel compiler (15.03) gives expected results. Maybe related to bug 50221? 1) Expected results (Intel compiler) ------------------------------------- length main program before 0 length intermediate before 0 length inner before 0 length inner after 28 here the word is finally set length intermediate after 28 here the word is finally set length main program after 28 final result:here the word is finally set 2) Trunk gfortran output (compiled will -Wall -Wextra) ------------------------------------------------------ length main program before 0 length intermediate before 0 length inner before 0 length inner after 28 here the word is finally set length intermediate after 28 here the word is finally set length main program after 0 final result: 3) Gfortran 4.9.3 output ------------------------ test_allocatable_string.f90: In function ‘test’: test_allocatable_string.f90:10:0: internal compiler error: in gimplify_expr, at gimplify.c:8538 allocate(character(len=0) :: my_string_type%name) ^ 0x7c5472 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc-4.9.3/gcc/gimplify.c:8538 0x7ca719 gimplify_modify_expr ../../gcc-4.9.3/gcc/gimplify.c:4510 0x7c3c31 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc-4.9.3/gcc/gimplify.c:7627 0x7c66f6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc-4.9.3/gcc/gimplify.c:5373 0x7c4b0b gimplify_statement_list ../../gcc-4.9.3/gcc/gimplify.c:1432 0x7c4b0b gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc-4.9.3/gcc/gimplify.c:8042 0x7c66f6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc-4.9.3/gcc/gimplify.c:5373 0x7c3b5c gimplify_and_add ../../gcc-4.9.3/gcc/gimplify.c:385 0x7c3b5c gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc-4.9.3/gcc/gimplify.c:7964 0x7c66f6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc-4.9.3/gcc/gimplify.c:5373 0x7c6f96 gimplify_bind_expr ../../gcc-4.9.3/gcc/gimplify.c:1099 0x7c3a2a gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc-4.9.3/gcc/gimplify.c:7824 0x7c66f6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc-4.9.3/gcc/gimplify.c:5373 0x7c763a gimplify_body(tree_node*, bool) ../../gcc-4.9.3/gcc/gimplify.c:8734 0x7c7987 gimplify_function_tree(tree_node*) ../../gcc-4.9.3/gcc/gimplify.c:8887 0x6c4877 cgraph_analyze_function(cgraph_node*) ../../gcc-4.9.3/gcc/cgraphunit.c:648 0x6c56b7 analyze_functions ../../gcc-4.9.3/gcc/cgraphunit.c:1016 0x6c6415 finalize_compilation_unit() ../../gcc-4.9.3/gcc/cgraphunit.c:2328 0x82f844 write_global_declarations() ../../gcc-4.9.3/gcc/langhooks.c:323 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.