Here is a program demonstrating the run-time error mentioned in the title. I believe this is a bug in IFORT 16.0.0
Program test Implicit None Type string(slen) Integer, Len :: slen Character :: its_value(slen) End Type string Type(string(5)), Dimension(:), Allocatable :: my_string1 Type(string(5)), Dimension(:), Allocatable :: my_string2 Integer :: stat Call allocate_string(my_string1) If(Allocated(my_string1)) Then Print '(a, 1i1)', "my_string1 was allocated with len = ", my_string1%slen Deallocate(my_string1, Stat = stat) End If Print * If(stat /= 0) Then Print '(a)', "Something is wrong, because" Print '(a, i3)', "deallocation of my_string1 failed with status ", stat End If Print * !The problem appears to be the value of the assumed length parameter slen inside the !Allocate statement of the subroutine allocate_string. If we do the allocation outside, !then the interface of allocate_string seems to properly transfer the value !of the assumed length parameter slen in and out the body of the subroutine Allocate(string(5) :: my_string2(3)) Call allocate_string(my_string2) Contains Subroutine allocate_string(my_string) Type(string(*)), Dimension(:), Allocatable, Intent(InOut) :: my_string ! If needed, perform typed allocation with the string len parameter being assumed If(.Not.Allocated(my_string)) Allocate(string(*) :: my_string(3)) Print '(a )', "I am supposed to print 5" Print '(a, 1i1)', "I am printing ", my_string%slen End Subroutine allocate_string End Program test