When I compile the following code:
module greet_m
implicit none
interface
module subroutine hello (name)
character (len=*), intent (in), optional :: name
end subroutine hello
end interface
end module greet_m
submodule (greet_m) greet_implementation_sm
contains
module subroutine hello (name)
character (len=*), intent (in), optional :: name
if (present (name)) then
print '("Hello ", a, "!")', name
else
print '("Hello World!")'
end if
end subroutine hello
end submodule greet_implementation_sm
program greeting
use greet_m, only: hello
implicit none
call hello
call hello ('John')
end program greeting
with:
gfortran -Wuse-without-only greeting.f90
gfortran warns me with:
greeting.f90:13:19:
13 | submodule (greet_m) greet_implementation_sm
| 1
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
So it seems in submodule (greet_m) greet_implementation_sm
, gfortran behaves like use greet_m
and imports all symbols from greet_m
module. This is normal behavior for submodule witch can access all symbols from parent module.
Did I missed something, or this is false positive warning from gfortran and I must fill a bug to them?