https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121939

            Bug ID: 121939
           Summary: [15/16 Regression] ICE in gfc_conv_string_parameter,
                    at fortran/trans-expr.cc:11450
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

While working on pr108581, I tried to used character(kind=4) and hit:

program dtest
  implicit none
  integer, parameter :: x = 1, y = 2, l = 3
  integer, parameter :: ck = 4                  ! Character kind=1 works
  character(len=:,kind=ck), pointer  :: d(:,:) => NULL()
  allocate (character(len=l,kind=ck) :: d(x, y))
  d(:, y) = ck_'ABC' ! ICE
end program dtest

With curent 15-branch (same with 16-trunk) I get:

pr108581-z3.f90:7:26:

    7 |   d(:, y) = ck_'ABC' ! ICE
      |                          1
internal compiler error: in gfc_conv_string_parameter, at
fortran/trans-expr.cc:11450
0x21e1bd9 internal_error(char const*, ...)
        ../../gcc-15/gcc/diagnostic-global-context.cc:517
0x7b971a fancy_abort(char const*, int, char const*)
        ../../gcc-15/gcc/diagnostic.cc:1749
0x77689a gfc_conv_string_parameter(gfc_se*)
        ../../gcc-15/gcc/fortran/trans-expr.cc:11450
0x9205f8 gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool, bool)
        ../../gcc-15/gcc/fortran/trans-expr.cc:11499
0x9399dd gfc_trans_assignment_1
        ../../gcc-15/gcc/fortran/trans-expr.cc:13241
0x8e6137 trans_code
        ../../gcc-15/gcc/fortran/trans.cc:2338
0x919953 gfc_generate_function_code(gfc_namespace*)
        ../../gcc-15/gcc/fortran/trans-decl.cc:8066
0x883027 translate_all_program_units
        ../../gcc-15/gcc/fortran/parse.cc:7432
0x883027 gfc_parse_file()
        ../../gcc-15/gcc/fortran/parse.cc:7752
0x8e31bf gfc_be_parse_file
        ../../gcc-15/gcc/fortran/f95-lang.cc:247

Versions 9 to 14 do not crash here.

Reply via email to