https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83196
Bug ID: 83196 Summary: ICE in gfc_build_compare_string, at fortran/trans-expr.c:3609 (and others) Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- This function reference in "s" misses obligatory parentheses : $ cat z1.f90 program p call s contains subroutine s if ( f /= 'abc' ) call abort end character(3) function f() f = 'abc' end end $ gfortran-8-20171126 -c z1.f90 -O2 z1.f90:5:0: if ( f /= 'abc' ) call abort internal compiler error: Segmentation fault 0xb6848f crash_signal ../../gcc/toplev.c:325 0x7600d6 gfc_build_compare_string(tree_node*, tree_node*, tree_node*, tree_node*, int, tree_code) ../../gcc/fortran/trans-expr.c:3609 0x76a0ae gfc_conv_expr_op ../../gcc/fortran/trans-expr.c:3385 0x769993 gfc_conv_expr_val(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:7905 0x7989a7 gfc_trans_if_1 ../../gcc/fortran/trans-stmt.c:1319 0x79f71a gfc_trans_if(gfc_code*) ../../gcc/fortran/trans-stmt.c:1356 0x734747 trans_code ../../gcc/fortran/trans.c:1916 0x75b42c gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6437 0x75b2a7 gfc_generate_contained_functions ../../gcc/fortran/trans-decl.c:5449 0x75b2a7 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6366 0x6ed280 translate_all_program_units ../../gcc/fortran/parse.c:6092 0x6ed280 gfc_parse_file() ../../gcc/fortran/parse.c:6295 0x731abf gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204 Nearby with -O0 : $ gfortran-8-20171126 -c z1.f90 -O0 z1.f90:5:0: if ( f /= 'abc' ) call abort internal compiler error: Segmentation fault 0xb6848f crash_signal ../../gcc/toplev.c:325 0x76000f gfc_build_compare_string(tree_node*, tree_node*, tree_node*, tree_node*, int, tree_code) ../../gcc/fortran/trans-expr.c:3629 #...