Kurt,
-----Original Message-----
From: Kurt W. Hirchert [mailto:[log in to unmask]]
At 06:57 PM 6/6/00 -0700, Van Snyder wrote:
>1. What do you think the "right" answers are for P1 and P2?
There is no "right" answer -- the program appears not to be standard
conforming:
When a dummy argument has the TARGET attribute and a pointer is
associated
with it, there are two possible cases:
1. If the corresponding actual argument also has the TARGET attribute,
the
pointer is also associated with the actual argument and the pointer
remains
defined after the execution of the procedure.
2. If the corresponding actual argument does not have the TARGET
attribute,
then the pointer is associated only with the dummy argument and the
pointer's association status becomes undefined after the execution of
the
procedure.
......
-Kurt
==> You have brought up an interesting point. If I do like this,
integer :: T1(16) = (/ (i,i=1,16) /) ! no target
attribute
integer, target :: T1_tar(16) = (/ (i,i=1,16) /) ! with target
attribute
p1 => res(T1)
p1_tar => res(t1_tar)
Both give the same answer. The P1 and P1_tar pointers are still valid
after the procedure is over. So, What is the difference. What should be
right.
Here I used CVF 6.10, though in the past I have used similar concept on
Sun Workshop and Nag compilers.
-Mandeep
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|