Dear Paul,
Paul Richard Thomas wrote:
As noted by Janus in comment #2 of the PR, "I think the function
'copy_ts_from_selector_to_associate' comes too early (namely during
parsing). It tries to resolve the target expr, which should rather
wait until resolution stage!?!"
It turned out that the function of the call to gfc_resolve_expr was to
fix up the selector array reference type. This has been done
explicitly in this patch.
Bootstraps and regtests on FC17/x86_64 - OK for trunk and 4.7?
It looks mostly okay; however, you do not handle vector sections
correctly, which leads to an ICE. Without your patch, one gets:
Error: CLASS selector at (1) needs a temporary which is not yet
implemented
With your patch, it fails as one has:
(gdb) p ref->next->u.ar.type
$7 = AR_ELEMENT
(gdb) p ref->next->u.ar.dimen_type
$8 = {DIMEN_VECTOR, 0, 0, 0, 0, 0, 0}
Please fix the DIMEN_VECTOR handling and add a test case for it (e.g.
the one below). Could you also check whether we have a PR for that "not
yet implemented" error?
module gn
type :: ncb
end type ncb
type, public :: tn
class(ncb), allocatable, dimension(:) :: cb
end type tn
contains
integer function name(self)
implicit none
class (tn), intent(in) :: self
select type (component => self%cb([4,7+1]))
end select
end function name
end module gn
I am not quite sure whether the following ICE has the same cause or a
different one, but it also ICEs with your patch applied:
module gn
type :: ncb
end type ncb
type, public :: tn
class(ncb), allocatable :: cb[:]
end type tn
contains
integer function name(self)
implicit none
class (tn), intent(in) :: self
select type (component => self%cb[4])
! ALSO FAILS: "(component => self%cb)"
end select
end function name
end module gn
Tobias