https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63535
Bug ID: 63535
Summary: SELECT TYPE shouldn't pass ALLOCATABLE/POINTER
attribute through
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
>From https://groups.google.com/forum/#!topic/comp.lang.fortran/mv0SN_T_2xI
The following compiles and write "1", but it should be rejected. (Printing 1
instead of "2" is also odd from a user perspective.)
Quoting Wolfgang Kilian:
"The attributes of the associating entity are listed in 8.1.3.3 of the
F2008 standard. (Maybe some other clauses also apply.) The ALLOCATABLE
attribute is not among the possible attributes for the associating
entity. (Neither is POINTER.)"
program test
class(*), allocatable :: a(:)
allocate(real :: a(1))
select type(a)
type is(real)
deallocate(a)
allocate(a(2))
class default
stop "error"
end select
print *,size(a)
end