Hello,
here's an example demosntrating that double allocation of polymorphic variables does not cause a runtime error condition, as expected.
program p type derived_type integer, dimension(99) :: lost end type type(derived_type), allocatable :: my_static class(derived_type), allocatable :: my_polymorphic ! runtime-check does not catch double allocation! allocate(my_polymorphic, source = derived_type(1)) allocate(my_polymorphic, source = derived_type(1)) ! runtime-check catches all following double allocations: ! forrtl: severe (151): allocatable array is already allocated ! allocate(my_polymorphic) ! allocate(my_polymorphic) ! ! allocate(my_static) ! allocate(my_static) ! ! allocate(my_static, source = derived_type(1)) ! allocate(my_static, source = derived_type(1)) end program
With regards,
Ferdinand