R. T. (Fortran Man)
03-08-2004, 06:38 PM
Please provide examples of WinFDB restrictions.
Lahey Support
03-08-2004, 06:43 PM
! Example One
! Showing module variable by host association is restricted except top position routine.
module t_mod
integer :: b
contains
subroutine sub1()
b = 1
end subroutine
subroutine sub2()
b = 3 ! Cannot access module variable b by host association.
end subroutine
end module
program tt
use t_mod
call sub1()
call sub2()
end program
-----
!Example Two
!Showing variable is restricted when POINTER attribute of dummy argument.
!subroutine foo(a)
integer,pointer,dimension(:)::a ! Cannot access variable a
i=a(2)
j=a(4)
print *,i,j
end
interface
subroutine foo(a)
integer,pointer,dimension(:)::a
end subroutine
end interface
integer,pointer,dimension(:)::a
allocate (a(2:4))
a(2)=200
a(4)=400
call foo(a)
end
-----
!Example 3
!Showing variable is restricted when ALLOCATE attribute of dummy argument.
!
subroutine foo(a)
integer,allocatable,dimension(:)::a ! Cannot access variable a
i=a(2)
j=a(4)
print *,i,j
end
interface
subroutine foo(a)
integer,allocatable,dimension(:)::a
end subroutine
end interface
integer,allocatable,dimension(:)::a
allocate (a(2:4))
a(2)=200
a(4)=400
call foo(a)
end
-----
! Example Four
! Lower and upper bound information are restricted when POINTER attribute for
! component of dummy argument.
subroutine foo(x)
type a
sequence
integer,pointer,dimension(:)::v
character(len=2),pointer,dimension(:)::t! Lower and upper bound are incorrect
end type
character(2)::t1,t2
type(a)::x
allocate(x%v(2:4))
allocate(x%t(5:7))
x%v(2)=100
x%v(4)=200
i=x%v(2)
j=x%v(4)
print *,i,j
x%t(5)='ab'
x%t(7)='cd'
t1=x%t(5)
t2=x%t(7)
print *,t1,t2
end
type a
sequence
integer,pointer,dimension(:)::v
character(len=2),pointer,dimension(:)::t
end type
type(a)::x
call foo(x)
end
-----
! Example Five
! On following information are restricted when ALLOCATABLE attribute for component of dummy argument.
! 1) Show incorrect attribute.
! 2) Lower and upper bound are incorrect.
subroutine foo(x)
type a
sequence
integer,allocatable,dimension(:)::v ! Show as POINTER attribute
character(len=2),allocatable,dimension(:)::t! Lower and upper bound are incorrect.
! Show as POINTER attribute
end type
character(2)::t1,t2
type(a)::x
allocate(x%v(2:4))
allocate(x%t(5:7))
x%v(2)=100
x%v(4)=200
i=x%v(2)
j=x%v(4)
print *,i,j
x%t(5)='ab'
x%t(7)='cd'
t1=x%t(5)
t2=x%t(7)
print *,t1,t2
end
type a
sequence
integer,allocatable,dimension(:)::v
character(len=2),allocatable,dimension(:)::t
end type
type(a)::x
call foo(x)
end
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.