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

            Bug ID: 117347
           Summary: Associate with derived type array constructor
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.pribec at gmail dot com
  Target Milestone: ---

! picalc.f90
program picalc
implicit none
integer, parameter :: dp = kind(1.0d0)
integer :: i, n
type :: point
   real(dp) :: x, y
end type
real(dp) :: pi
n = 1000
associate(points => [(random_point(),i=1,n)])
   pi = count(points%x**2 + points%y**2 < 1,dim=1) * 4.0_dp/n
end associate
print '("pi = ", G0)', pi
contains
   function random_point() result(p)
      type(point) :: p
      call random_number(p%x)
      call random_number(p%y)
   end function
end program


The program doesn't compile due to the reported error

picalc.f90:11:22:

   11 |    pi = count(points%x**2 + points%y**2 < 1,dim=1) * 4.0_dp/n
      |                      1
Error: Symbol 'points' at (1) has no IMPLICIT type

Reply via email to