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

            Bug ID: 125021
           Summary: [Coarray] internal compiler error, possible regression
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

I thought I'd give the new shmem coarray implementation in gfortran 16.0 a try.
But I'm getting an ICE on my code. Here's a small reproducer. I need to check,
but I think this must be a regression, because this used to work with
opencoarrays (and gfortran 12?).

type box
  integer, allocatable :: data(:)
end type
type(box), allocatable :: buffer[:]

integer :: i, n

allocate(buffer[*])
allocate(buffer%data(1), source=this_image())
sync all

i = 1 + modulo(this_image(), num_images())
n = buffer[i]%data(1)
if (n /= i ) error stop
end

$ gfortran --version
GNU Fortran (GCC) 16.0.1 20260425 (prerelease)

$ gfortran -fcoarray=lib gfortran-20260425.f90 -lcaf_shmem
gfortran-20260425.f90:24:4:

   24 | n = buffer[i]%data(1)
      |    1
internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.cc:3002
0x1f159ff internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0x453cb1 fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1813
0x5deef2 gfc_conv_component_ref(gfc_se*, gfc_ref*)
        ../../gcc/fortran/trans-expr.cc:3002
0x5f3bef gfc_conv_variable
        ../../gcc/fortran/trans-expr.cc:3430
0x5f6fd6 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.cc:10801
0x606bd2 conv_isocbinding_function
        ../../gcc/fortran/trans-intrinsic.cc:9885
0x5f9009 gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/trans-expr.cc:11216
0x5a2d77 trans_code
        ../../gcc/fortran/trans.cc:2368
0x5d9f9b gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:8303
0x5d9d7c gfc_generate_contained_functions
        ../../gcc/fortran/trans-decl.cc:6394
0x5d9d7c gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:8235
0x533676 translate_all_program_units
        ../../gcc/fortran/parse.cc:7596
0x533676 gfc_parse_file()
        ../../gcc/fortran/parse.cc:7926
0x59f99f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:247
/opt/gcc/16.0.1/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/f951
gfortran-20260425.f90 -quiet -dumpdir a- -dumpbase gfortran-20260425.f90
-dumpbase-ext .f90 -mtune=generic -march=x86-64 -fcoarray=lib
-fintrinsic-modules-path
/opt/gcc/16.0.1/lib/gcc/x86_64-pc-linux-gnu/16.0.1/finclude
-fpre-include=/usr/include/finclude/math-vector-fortran.h -o /tmp/ccHpvNWu.s

Reply via email to