This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine.
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2007 14:16:45 -0000
- Subject: [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
After PR 33997 turned out to be no bug, there is the following program, which
gfortran wrongly accepts.
A bit oddly the Fortran standard does not distinguish between variables and
functions and subroutines are wild matches. The following is the relevant part
from the Fortran 2003 standard ("16.2.3 Restrictions on generic declarations"):
"Two dummy arguments are distinguishable if neither is a subroutine and neither
is TKR compatible (5.1.1.2) with the other."
module ambiguous
implicit none
interface both
module procedure test1, test2
end interface both
contains
function test1(x)
implicit integer(x)
integer test1
test1 = 1
end function test1
function test2(x)
interface
subroutine x()
end subroutine x
end interface
integer test2
test2 = 2
end function test2
subroutine test3
end subroutine test3
end module ambiguous
program main
use ambiguous
implicit none
write(*,*) both(1)
write(*,*) both(test3)
end program main
--
Summary: Accepts invalid: Ambigiuous interface with subroutine.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34004