Nvfortran error on valid-code: accessing private components of UDT

Hi all,
this is probably a different incarnation of TPR #27323, but I wanted to report it nevertheless. The problem appears if a contained subroutine/function in a subroutine or function local to a submodule (i.e. not being a module subroutine) tries to modify private components of a UDT defined within the submodule’s module. This triggers the error (me referring to 22.3-0 on x86-64 Linux):
NVFORTRAN-S-0155-Attempt to use private component: p (permutations.f90: 32)
0 inform, 0 warnings, 1 severes, 0 fatal for insert
for the simple example:

module m
  implicit none
  private
  public :: t1

  type :: t1
     private
     integer :: p
  end type t1
  interface
    module subroutine s1 ()
      end subroutine s1
  end interface

end module m

submodule (m) m_s
  implicit none
contains
  module subroutine s1 ()
  end subroutine s1

  subroutine s2 (pa)
    type(t1), dimension(:), intent(inout) :: pa
  contains
    subroutine insert (p)
      type(t1), intent(inout) :: p
      p%p = 0
    end subroutine insert
  end subroutine s2
end submodule m_s

Thanks Juergen,

It looks to me to have the same root cause where a base module’s private variables are not accessible to a submodule. I’ve added this test case to TPR #27323, though we may split it off if it turns out to be a different issue.

-Mat