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

            Bug ID: 122669
           Summary: ALLOCATE without array specification or array-valued
                    SOURCE= expression fails in compilation
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

The following is lifted from pr122578 comment 5:

  implicit none
  type tensor_t
    real, allocatable :: values_
  end type
  type(tensor_t) random_inputs(1)
  type(tensor_t), allocatable :: outputs(:)
  allocate(outputs, mold=random_inputs)
end 

$ gfortran reproducer.f90 
reproducer.f90:7:12:

    7 |   allocate(outputs, mold=random_inputs)
      |            1~~~~~~
Error: Array specification or array-valued SOURCE= expression required in
ALLOCATE statement at (1)

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

Reply via email to