Compiling the following Fortran90 program
with HP Fortran90 V1 and Mips Pro Fortran90 7.20
gives an error :
% cat generic.f90
module trygen
implicit none
real, public :: r
public :: subr
private :: subr1, subr2
interface subr
module procedure subr1, subr2
end interface
contains
subroutine subr1(proc)
interface
function proc(intarg)
integer :: proc
integer, intent(in) :: intarg
end function proc
end interface
r = proc(12)
end subroutine subr1
subroutine subr2(proc)
interface
function proc(realarg)
real :: proc
real, intent(in) :: realarg
end function proc
end interface
r = proc(14.0)
end subroutine subr2
end module trygen
program try_gen
use trygen
interface
integer function fi(i)
integer :: i
end function fi
real function fr(r)
real :: r
end function fr
end interface
call subr(fi)
print *, r
call subr(fr)
print *, r
end program try_gen
integer function fi(i)
fi = 2 * i
end function fi
real function fr(r)
fr = 3.141596 * r
end function fr
Using Mips Pro Fortran90 7.20
=============================
%f90 generic.f90
module trygen
^
cf90-855 mfef90: ERROR TRYGEN, File = generic.f90, Line = 1, Column = 8
The compiler has detected errors in module "TRYGEN". No module
information file will be created for this module.
module procedure subr1, subr2
^
cf90-487 mfef90: ERROR TRYGEN, File = generic.f90, Line = 7, Column = 30
The specific interfaces for "SUBR2" and "SUBR1" make the GENERIC
interface "SUBR" ambiguous.
use trygen
^
cf90-894 mfef90: ERROR TRY_GEN, File = generic.f90, Line = 36, Column =
7
Module "TRYGEN" has compile errors, therefore declarations obtained
from the module via the USE statement may be incomplete.
f90: MIPSpro Fortran 90 Version 7.2 (f19) Tue Sep 22, 1998 15:52:20
f90: 55 source lines
f90: 3 Error(s), 0 Warning(s), 0 Other message(s), 0 ANSI(s)
Using HP Fortran90 v!.0
=======================
biceps 184: f90 generic.f90
generic.f90
module TRYGEN
module subroutine SUBR1
module subroutine SUBR2
program TRY_GEN
call subr(fi)
^
Error 260 at (45:generic.f90) : This subroutine has the wrong number of
arguments or arguments with the wrong name, type or rank
call subr(fr)
^
Error 260 at (47:generic.f90) : This subroutine has the wrong number of
arguments or arguments with the wrong name, type or rank
external function FI
external function FR
2 Errors
f90: Errors detected, no link.
Is this Fortran90 program non standard conforming ?
Thank you
--
Christian de Polignac
Institut Laue Langevin
156 X
38042 Grenoble Cedex France
e-mail : [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|