https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123208
--- Comment #3 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Steve Kargl from comment #1)
> F2023
> C817 An access-spec shall appear only in the specification-part of a module.
Flushing out your example, 'j' is in the spec-part of the submodule sm
and available to the implementation of s(). 'j' is not made available
through use association via 'use m' in the program. What do you
want the 'private' attribute to do here?
module m
implicit none
interface
module subroutine s()
end subroutine
end interface
end module
submodule (m) sm
integer, parameter :: j = 42
type :: t
real x
end type
contains
subroutine s()
type(t) :: a=t(real(j))
print *, a%x
end subroutine s
end submodule
program foo
use m
implicit none
call s
print *, j
end program foo