http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46371
Summary: [OOP] SELECT TYPE: scalar coarray variable is rejected
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Example has been taken from the interpretation request at
http://j3-fortran.org/doc/meeting/193/10-209r1.txt ; the IR does not contain a
suggested edits.
The following program, which needs two images at run time is regarded as valid
(with select 1 commented out) - if the ALLOCATE is not commented out. (The
ALLOCATE statement is commented-out because of PR 46370.)
Using gfortran -fcorarray=single, it fails with:
select type(o_foo) ! 3 VALID
1
Error: Selector in SELECT TYPE at (1) is not a named variable; use
associate-name=>
module m
type :: foo
integer :: i = 0
end type
end module m
program p
use m
type(foo), allocatable :: o_foo[:]
integer :: j
! allocate(foo :: o_foo[*])
if (this_image() == 1) then
! select type(a => o_foo[2]) ! 1 INVALID
! type is(foo)
! j = a%i
! end select
! select type(a => o_foo) ! 2 VALID
! type is(foo)
! j = a[2]%i
! end select
select type(o_foo) ! 3 VALID
type is(foo)
j = o_foo[2]%i
end select
end if
end program p