https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125531
Bug ID: 125531
Summary: Inferred-type ASSOCIATE name gives spurious "Expected
argument list" when data component shares name
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jvdelisle at gcc dot gnu.org
Target Milestone: ---
When an ASSOCIATE construct uses a contained function as its selector and the
result type has a data component whose name also matches a type-bound procedure
name, gfortran spuriously rejects the data-component access with "Expected
argument list".
program test
implicit none
type :: args_t
integer :: order_ = 4
integer :: cells_ = 20
double precision :: x_min_ = 0d0, x_max_ = 1d0
end type
associate (args => get_args ())
associate (result => compute (args%order_, args%cells_))
print *, result
end associate
end associate
contains
function get_args () result (r)
type(args_t) :: r
r%order_ = 2
r%cells_ = 10
end function
function compute (order, cells) result (r)
integer, intent(in) :: order, cells
integer :: r
r = order * cells
end function
end program
$ gfortran associate_infer_program_type.f90
gfortran rejects args%order_ and args%cells_ with
"Expected argument list". The program should compile
and run cleanly.