https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102112
Bug ID: 102112
Summary: Cannot associate with component of associate target
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: everythingfunctional at protonmail dot com
Target Milestone: ---
I'm using version Ubuntu 11.1.0-1ubuntu1~21.04 on Pop!OS.
The compiler is rejecting valid code using associate, in this instance when
trying to associate to a component of a target in an associate. Note that this
also occurs when calling a type-bound procedure of the target.
program main
implicit none
type :: sub_t
integer :: val
end type
type :: obj_t
type(sub_t) :: sub_obj
end type
associate(initial_sub => sub_t(42))
associate(obj => obj_t(initial_sub))
associate(sub_obj => obj%sub_obj)
end associate
end associate
end associate
end program
gives
app/main.f90:14:33:
14 | associate(sub_obj => obj%sub_obj)
| 1
Error: Invalid association target at (1)