GNOME Bugzilla – Bug 636949
Fortran: INTERFACEs in procedures and unnamed INTERFACEs
Last modified: 2010-12-19 21:29:35 UTC
Interfaces in functions/subroutines should not be extracted, e.g. in SUBROUTINE foo(n) USE ISO_C_BINDING INTEGER, INTENT(out) INTERFACE FUNCTION c_foo() BIND(C, NAME="foo") END FUNCTION END INTERFACE n = c_foo() END SUBROUTINE the c_foo interface should not be extracted and listed as interface by default (EXTRACT_PRIVATE=NO). It is not globally accessible. Also, an unnamed interface as MODULE iface INTERFACE SUBROUTINE xyz(a, b, c) INTEGER :: a, b, c END SUBROUTINE END MODULE has the name XYZ. In fortranscanner.l, line 421 (r749), one finds the comment: "// interface without name, must be inside subprog" which is incorrect. The above example is perfectly valid. The name may be used to facilitate overloading and provide a generic name to different prototypes/interfaces, e.g. MODULE iface INTERFACE xyz SUBROUTINE xyz_sngl(x) REAL(4) :: x END SUBROUTINE SUBROUTINE xyz_dbl(x) REAL(8) :: x END SUBROUTINE END MODULE Here, XYZ is the generic name of the interface for XYZ_SNGL and XYZ_DBL.
Ups, the first part of this PR is a dupe of #521859.
Comment #0 refers to GENERIC interfaces. However, for ABSTRACT interfaces, this is different. E.g. ABSTRACT INTERFACE SUBROUTINE a END SUBROUTINE SUBROUTINE b(i) INTEGER :: i END SUBROUTINE REAL FUNCTION f(x) REAL :: x END FUNCTION END INTERFACE is valid and equivalent to ABSTRACT INTERFACE SUBROUTINE a END SUBROUTINE END INTERFACE ABSTRACT INTERFACE SUBROUTINE b(i) INTEGER :: i END SUBROUTINE END INTERFACE ABSTRACT INTERFACE REAL FUNCTION f(x) REAL :: x END FUNCTION END INTERFACE So, the first version needs to produce three INTERFACE entries, each with its own name.
*** This bug has been marked as a duplicate of bug 637610 ***