The following code has an ambiguous interface, sub_a and sub_b are identical.
This is correctly reported as an error, if sub_a/sub_b are the only procedures
listed. Adding a third and different overload to the interface (sub_c), the
ambiguity in sub_a/sub_b goes undetected. 

$> cat iface.f90
MODULE mod
INTERFACE iface
  MODULE PROCEDURE sub_a
  MODULE PROCEDURE sub_b
  MODULE PROCEDURE sub_c
END INTERFACE
CONTAINS
  SUBROUTINE sub_a(x)
    INTEGER, INTENT(in) :: x
    WRITE (*,*) 'A: ', x
  END SUBROUTINE
  SUBROUTINE sub_b(y)
    INTEGER, INTENT(in) :: y
    WRITE (*,*) 'B: ', y
  END SUBROUTINE
  SUBROUTINE sub_c(x, y)
    REAL, INTENT(in) :: x, y
    WRITE(*,*) x, y
  END SUBROUTINE
END MODULE

PROGRAM test_interface
  USE mod
  CALL iface(42)
END PROGRAM

$> gfortran-svn -g -Wall iface.f90 && ./a.out
 B:           42

$> gfortran-svn -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../svn/gcc/configure --prefix=$(localpath) --disable-nls
--enable-threads=posix --enable-shared --enable-bootstrap --with-system-zlib
--program-suffix=-svn --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.0 20061030 (experimental)


-- 
           Summary: ambiguous interface declaration undetected
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: franke dot daniel at gmail dot com
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29652

Reply via email to