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

            Bug ID: 122109
           Summary: gfortran 16 rejects component declaration in composite
                    derived type with kind parameter
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

Unlike PR 93175, the code below involves no length type parameters and requires
triple nesting to reproduce the error message.  Also, 

1. Removing the allocable attribute on values_ causes an ICE.
2. Removing the expected_outputs_ component causes an ICE.
3. Putting the same code in a program instead of a module compiles without
error.

$ cat reproducer.f90 
module tensor_m
  implicit none

  type tensor_t(k)
    integer, kind :: k = kind(1.)
    real(k), allocatable :: values_ 
  end type

  type input_output_pair_t(k)
    integer, kind :: k
    type(tensor_t(k)) inputs_, expected_outputs_
  end type

  type mini_batch_t(k)
    integer, kind :: k
    type(input_output_pair_t(k)) input_output_pairs_
  end type

end module tensor_m

$ gfortran -c reproducer.f90 
reproducer.f90:6:35:

    6 |     real(k), allocatable :: values_
      |                                   1
Error: Cannot convert REAL(0) to REAL(4) at (1)

$ gfortran --version
GNU Fortran (GCC) 16.0.0 20250930 (experimental)

Reply via email to