FTN95 version 7.20 crashes when calling a subroutine/function with an optional, output parameter that is a type with initialiser.
In the following example:
module TestOptionalParam
type OptionalType
integer:: intVal = 42 ! crash with initialisation, works if omitted
end type OptionalType
contains
subroutine FuncWithOptParam(optParam)
type(OptionalType), optional, intent(out):: optParam
end subroutine FuncWithOptParam
end module TestOptionalParam
program TestOptionalParamFunc
use TestOptionalParam
type(OptionalType):: param
call FuncWithOptParam(param) ! no not crash if param present
call FuncWithOptParam() ! crashes with param missing
end program TestOptionalParamFunc
The crash occurs on the second entry to the subroutine. It is caused by the combination of: . initialisation within the type - if the initialisation is removed the call succeeds . intent(out) - if this is removed or changed to intent(in out) all is well . if the optional parameter is included in the call it's okay
This worked fine in 7.10.
Alan