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

            Bug ID: 120847
           Summary: [Coarray] ICE after "Component ... already declared
                    at..." when type with coarray comp is defined
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vehre at gcc dot gnu.org
  Target Milestone: ---

Reproducer:

program p
  implicit none

  type T
    integer, allocatable :: i(:, :) [:]
  end type T

  type(T) :: o
  integer, allocatable :: c[:]
  integer :: i

  c = 7

  allocate(o%i(4, 5)[*], source=6)

  do i = 1, 4
    c = o%i(mod(i, 2), mod(i, 3))[1]
  end do

end program p

produces:

$ gfortran-16 -c p,f90 -fcoarray=lib
p.f90:1:9:

    1 | program p
      |         1
......
   17 |     c = o%i(mod(i, 2), mod(i, 3))[1]
      |            2
Error: Component 'caf_temp_mod_0' at (1) already declared at (2)
f951: internal compiler error: in find_comp, at fortran/coarray.cc:490
0x2c47a29 internal_error(char const*, ...)
        /mnt/work_store/gcc/gcc.test/gcc/diagnostic-global-context.cc:517
0x2c0642b fancy_abort(char const*, int, char const*)
        /mnt/work_store/gcc/gcc.test/gcc/diagnostic.cc:1810
0x42efcd find_comp
        /mnt/work_store/gcc/gcc.test/gcc/fortran/coarray.cc:490
0x42f124 check_add_new_comp_handle_array
        /mnt/work_store/gcc/gcc.test/gcc/fortran/coarray.cc:519
0x42feec check_add_new_component
        /mnt/work_store/gcc/gcc.test/gcc/fortran/coarray.cc:702
and so on...

Reply via email to