https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62125
Bug ID: 62125
Summary: Nested select type not accepted (rejects valid)
Product: gcc
Version: fortran-dev
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mrestelli at gmail dot com
Hi, I see that gfortran does not compile the attached code, which
seems fine to me.
$ gfortran -c test.f90 -o test.o
test.f90:31.21:
write(*,*) u%x
1
Error: 'x' at (1) is not a member of the 't1' structure
$ gfortran --version
GNU Fortran (GCC) 4.10.0 20140812 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
(As a reference, ifort accepts this code.)
Here is the code:
module m
implicit none
type, abstract :: t1
logical :: l
end type t1
type, extends(t1), abstract :: t2
integer :: i
end type t2
type, extends(t2), abstract :: t3
real :: x
end type t3
contains
subroutine s(u)
class(t1), intent(in) :: u
write(*,*) u%l
select type(u)
class is(t2)
write(*,*) u%i
select type(u)
class is(t3)
write(*,*) u%x
end select
end select
end subroutine s
end module m