Restricting access of contained procedure to variables in host

Thanks. Does the latest gfortran have this feature? Compiling your code above with GNU Fortran (GCC) 11.0.0 20200927 from equation.com, excluding the “error line”, I get

p.f90:9:16:

    9 |          import, only : x1 !<-- only x1 is imported from containing scope
      |                1
Error: IMPORT statement at (1) only permitted in an INTERFACE body
p.f90:15:8:

   15 |    use m, only : sub1
      |        1
Fatal Error: Cannot open module file 'm.mod' for reading at (1): No such file or directory
compilation terminated.

I may end up learning Fortran beyond F95 by asking for feature X and being told that it’s already in Fortran 2018. But now I do see section “5.20 Control of host association” in The new features of Fortran 2018 and will reread that document.