[Bug fortran/66993] New: Spurious ambiguous symbol error with submodules
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 24 12:11:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66993
Bug ID: 66993
Summary: Spurious ambiguous symbol error with submodules
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mikael at gcc dot gnu.org
Target Milestone: ---
Submodules host-associate the (sub-)module they derive from.
This means that when a symbol is use-associated with the same name as one of
the module's symbols, there is no ambiguity: the use-associated symbol has the
priority.
This doesn't work currently, as host-association as been implemented by reusing
the use-association mechanism. Module symbols are put at the same level as
use-associated symbols, and the compiler complains about an ambiguous symbol:
test.f90:15:16:
print *, i
1
Error: Name ‘i’ at (1) is an ambiguous reference to ‘i’ from module ‘m’
Testcase:
module m
integer, parameter :: i = -1
interface
module subroutine show_i
end subroutine show_i
end interface
end module m
module n
integer, parameter :: i = 2
end module n
submodule (m) sm
use n
contains
module subroutine show_i
print *, i
end subroutine show_i
end submodule sm
program p
use m
call show_i
end p
I believe this should be accepted and it should print 2.
More information about the Gcc-bugs
mailing list