https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101565
Bug ID: 101565 Summary: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Non-integer array SUB affects versions down to at least r5 : (z4 with a misleading error) $ cat z1.f90 program p integer :: x[*] print *, image_index(x, [1.0]) end $ cat z2.f90 program p integer :: x[*] print *, image_index(x, [.true.]) end $ cat z3.f90 program p type t integer :: a end type integer :: x[*] print *, image_index(x, [t(1)]) end $ cat z4.f90 program p integer :: x[*] print *, image_index(x, ['1']) end $ gfortran-12-20210718 -c z4.f90 -fcoarray=lib z4.f90:3:24: 3 | print *, image_index(x, ['1']) | 1 Error: Out of bounds in IMAGE_INDEX at (1) for dimension 1, SUB has 0 and COARRAY lower bound is 1) $ gfortran-12-20210718 -c z1.f90 -fcoarray=lib f951: internal compiler error: Segmentation fault 0xe3985f crash_signal ../../gcc/toplev.c:328 0x7d59d2 gfc_simplify_image_index(gfc_expr*, gfc_expr*) ../../gcc/fortran/simplify.c:8234 0x753f73 do_simplify ../../gcc/fortran/intrinsic.c:4664 0x75e99a gfc_intrinsic_func_interface(gfc_expr*, int) ../../gcc/fortran/intrinsic.c:5050 0x7af8b9 resolve_unknown_f ../../gcc/fortran/resolve.c:2926 0x7af8b9 resolve_function ../../gcc/fortran/resolve.c:3270 0x7af8b9 gfc_resolve_expr(gfc_expr*) ../../gcc/fortran/resolve.c:7104 0x7b5cf4 gfc_resolve_expr(gfc_expr*) ../../gcc/fortran/resolve.c:7071 0x7b5cf4 gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc/fortran/resolve.c:11832 0x7b463f gfc_resolve_blocks(gfc_code*, gfc_namespace*) ../../gcc/fortran/resolve.c:10851 0x7b4a08 gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc/fortran/resolve.c:11822 0x7b7317 resolve_codes ../../gcc/fortran/resolve.c:17427 0x7b73de gfc_resolve(gfc_namespace*) ../../gcc/fortran/resolve.c:17462 0x79f924 resolve_all_program_units ../../gcc/fortran/parse.c:6403 0x79f924 gfc_parse_file() ../../gcc/fortran/parse.c:6655 0x7ecf1f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:216