Gfortran 9.3 duplicated use error fix
Gfortran 9.3.0 has a new bug (or feature perhaps) of being sensitive to overlapping / duplicated use
elements in a module
- submodule
hierarchy.
That is, if a procedure is use
d in multiple places in the module - submodule hierarchy, only use
the procedure once at the highest necessary level of the hierarchy.
This is perhaps best shown by example:
module foo
implicit none (type, external)
contains
subroutine bar()
end subroutine bar
end module foo
module parent
use foo, only : bar
implicit none (type, external)
interface
module subroutine baz
end subroutine baz
end interface
end module parent
submodule (parent) child
use foo, only : bar !< this is unnecessary and triggers the Gfortran 9.3.0 error
implicit none (type, external)
contains
module procedure baz
end procedure baz
end submodule child
The error message from Gfortran 9.3.0 is like:
$ gfortran -c .\dupe.f90
dupe.f90:17:17:
17 | submodule (parent) child
| 1
18 | use foo, only : bar
| 2