https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108502
Bug ID: 108502 Summary: ICE in gfc_check_dependency, at fortran/dependency.cc:1295 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Affects versions down to at least r5 : $ cat z1.f90 integer function n() integer :: a(1) a = [1] / 0 end program p integer :: b = n() end $ cat z3.f90 integer function n() implicit none integer :: a(1) a = [1] / 0 n = 1 end program p implicit none integer :: n integer :: b = n() end $ cat z5.f90 integer function n() implicit none integer :: a(1) a = [1] / 0 n = 1 end program p integer, parameter :: b = n() end $ gfortran-13-20230122 -c z1.f90 -O2 f951: internal compiler error: Segmentation fault 0xdaa49f crash_signal ../../gcc/toplev.cc:314 0x86f6e1 gfc_check_dependency(gfc_expr*, gfc_expr*, bool) ../../gcc/fortran/dependency.cc:1295 0x86f70a gfc_check_dependency(gfc_expr*, gfc_expr*, bool) ../../gcc/fortran/dependency.cc:1298 0x90be8b optimize_assignment ../../gcc/fortran/frontend-passes.cc:1684 0x90be8b optimize_code ../../gcc/fortran/frontend-passes.cc:329 0x90f679 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int (*)(gfc_expr**, int*, void*), void*) ../../gcc/fortran/frontend-passes.cc:5352 0x910a2a optimize_namespace ../../gcc/fortran/frontend-passes.cc:1479 0x910e7f gfc_run_passes(gfc_namespace*) ../../gcc/fortran/frontend-passes.cc:169 0x8417a8 gfc_resolve(gfc_namespace*) ../../gcc/fortran/resolve.cc:17673 0x841bab gfc_resolve(gfc_namespace*) ../../gcc/fortran/resolve.cc:2635 0x841bab resolve_global_procedure ../../gcc/fortran/resolve.cc:2637 0x838a66 resolve_function ../../gcc/fortran/resolve.cc:3306 0x838a66 gfc_resolve_expr(gfc_expr*) ../../gcc/fortran/resolve.cc:7195 0x7c77a4 gfc_reduce_init_expr(gfc_expr*) ../../gcc/fortran/expr.cc:3168 0x7ca700 gfc_match_init_expr(gfc_expr**) ../../gcc/fortran/expr.cc:3216 0x7b442b variable_decl ../../gcc/fortran/decl.cc:3036 0x7b442b gfc_match_data_decl() ../../gcc/fortran/decl.cc:6343 0x8215d3 match_word ../../gcc/fortran/parse.cc:67 0x8215d3 decode_statement ../../gcc/fortran/parse.cc:378 0x82301a next_free ../../gcc/fortran/parse.cc:1403