contains
subroutine base_bar(f,j,k)
class(foo), intent(inout) :: f
integer, intent(in) :: j
integer, intent(inout) :: k
f%i = max(f%i,j)
k = k + f%i
end subroutine base_bar
end module foo_mod
module extfoo_mod
use foo_mod
type, extends(foo) :: extfoo
contains
procedure, pass(f) :: bar => ext_bar
end type extfoo
contains
subroutine ext_bar(f,j,k)
class(extfoo), intent(inout) :: f
integer, intent(inout) :: j
integer, intent(inout) :: k
f%i = max(f%i,j)
j = f%i
k = k + f%i
end subroutine ext_bar
end module extfoo_mod