(j3.2006) Question about separate module subprogram
Daniel C Chen
cdchen
Wed Oct 23 14:31:27 EDT 2013
Hello,
Please consider the following test case:
module m1
integer, parameter :: k = 8
integer :: l = 10
type dt
integer :: a = 4
end type
end module
module m2
interface
module subroutine sub1(arg1, arg2, arg3, arg4)
use m1
integer(kind=k) :: arg1
type(dt) arg2
integer :: arg3(k)
integer :: arg4(l)
end
module subroutine sub2(arg5)
use m1, n => l
integer :: arg5(n)
end
end interface
end module
submodule (m2) s1
contains
module procedure sub1
print*, kind(arg1) ! A1
print*, arg2%a ! A2
print*, ubound(arg3) ! A3
print*, ubound(arg4) ! A4
end
module procedure sub2
use m1
integer :: n = 9
print*, ubound(arg5) ! A5
end
end submodul
Question 1:
The entities defined in module m1 are accessible in module procedure
interface body sub1 via use association.
Are they also accessible from the separate module subprogram sub1 in
submodule s1?
Are A1, A2, A3 and A4 standard conforming and should the program prints 8,
4, 8 and 10?
Question 2:
Integer l from module m1 is renamed in module procedure interface body
sub2. A local variable n is
declared in separate module subprogram sub2. Is A5 standard conforming and
should it print 9 or 10?
Thanks,
Daniel
XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
http://www.ibm.com/software/awdtools/fortran/xlfortran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20131023/c70b70e1/attachment.html
More information about the J3
mailing list