https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832
Bug ID: 72832
Summary: [OOP] ALLOCATE with SOURCE fails to allocate requested
dimensions
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: daanvanvugt at gmail dot com
Target Milestone: ---
If I try to allocate a polymorphic variable with a specific dimension I do not
get the expected result. See this example:
program allocate_source
type :: t
end type t
type, extends(t) :: tt
end type tt
class(t), allocatable, dimension(:) :: a, b
allocate(tt::a(1:2))
write(*,*) size(a,1)
allocate(b(1:4), source=a)
write(*,*) size(b,1)
end program allocate_source
Which produces as output
2
2
While I expect the second line to be 4.