Is it OK to pass an unallocated mold
argument to transfer? For instance:
subroutine get_int32_key( key, value )
type(key_type), intent(in) :: key ! Details of type definition elided
integer(int32), allocatable, intent(out) :: value(:) ! Will be deallocated on input
value = transfer( key % value, value ) ! Here value isn't allocated on the RHS
end subroutine
The question arose in a pull request review for stdlib – I’m the reviewer but not sure if this is standard. The code has tests which pass, but there are some reports of segfaults in another use case, and I wonder if this could be the issue.