I have encountered a strange bug with host association and derived types.
The following code illustrates the bug. When the six comment lines are uncommented, the [u:6eda2d8d96]first[/u:6eda2d8d96] call to add_one does not occur and an 'Access Violation' error is given in the debugger.
Note that the error occurs before the call to the contained subroutine bbb.
With the comments in place the call to add_one works.
Hopefully, this is a small enough sample to allow this to be debugged.
Best Regards David.
module foo
type wrap_type
integer :: n = 10
end type wrap_type
contains
subroutine add_one(w)
type(wrap_type), intent(inout) :: w
w%n = w%n + 1
end subroutine add_one
end module foo
module routines
contains
subroutine aaa(w)
use foo
type (wrap_type), intent(inout) :: w
call add_one(w) !< Access Violation occurs when following comments are removed.
!call bbb
!contains
! subroutine bbb
! call add_one(w)
! end subroutine bbb
end subroutine aaa
end module routines
program check
use foo
use routines
type (wrap_type) :: w
call aaa(w)
end program check