This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/21401] New: INTERFACE/FUNCTION problem


The type of a function interface is not taken over from the 
MODULE PROCEDURE's which constitute the INTERFACE.

---BUG.f90--- start
module interface_vs_functions_bug
  implicit none
  
  private

  interface ex1 ! fails, but should be ok
     module procedure func1, func2
  end interface
  
  interface ex2 ! works by workaround below
     module procedure func1, func2
  end interface
  real :: ex2 
    ! This workaround should not even be allowed:
    ! func1 and func2 can differ in return type
    ! see eg Metcalf and Reid, Fortran 90/95 explained, sec. ed, p94

  interface ex3
     module procedure func1, func3
  end interface
  ! real :: ex3 !! This workaround is not possible here-
  !                return types of func1 and func 3 differ...

contains

   real function func1(x)
     real, intent(in) :: x
     func1 = 1.
   end function func1

   real function func2(i)
     integer, intent(in) :: i
     func2 = ex1(real(i))
     ! workaround:    func2 = func1(real(i))
   end function func2

   integer function func3(i)
     integer, intent(in) :: i
     func3 = 1
   end function func3
   
 end module Interface_vs_functions_bug
---BUG.f90--- end

Test compile:

gfortran -c BUG.f90
 In file BUG.f90:33

     func2 = ex1(real(i))
               1
Error: Symbol 'ex1' at (1) has no IMPLICIT type
----------

gcc -v
Es werden eingebaute Spezifikationen verwendet.
Ziel: i686-pc-linux-gnu
Konfiguriert mit: ../configure
Thread-Modell: posix
gcc-Version 4.0.0

-- 
           Summary: INTERFACE/FUNCTION problem
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: klra67 at freenet dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]