Print

Print


On Jun 7, 2004, at 5:11 PM, Richard Maine wrote:

> --On Monday, June 7, 2004 4:01 PM +0200 Drew McCormack
> <[log in to unmask]> wrote:
>
>> We have a compiler that is causing trouble when a pointer to an array
>> is passed to a f77-like implicit function. It seems it is probably
>> just
>> passing the memory address of the pointer object, rather than doing a
>> copy-in/copy-out, or something like that.
>
> I'll repeat one of my most common statements about requests for
> debugging
> help - I need data, not conclusions.  I can't really comment on the
> above,
> as it pretty much has no data - just conclusions, with no way for me to
> verify them.
That's why I provided a concrete example. That said, my example omitted
the most important thing, the pointer :-(
It should be like this:


real, target :: vertices(3, 3)
real, pointer :: vpoint(:,:)
real :: area, calcArea
...
vpoint => vertices(1:2,:)
area = calcArea( vpoint )

...

! In another file, with an implicit interface
real function calcArea( a )
real :: a(2, 3)
...
end function


I  think that is right now.

When I think about it, it is a little bit more involved, because the
target array is actually a member of a user-defined type, which has the
target attribute. Ie

type ( SomeType ), target :: parent

vpoint => parent % vertices(1:2, :)


>
> I see nothing wrong with the above code.  I also see no pointers in it,
> which leads me to be even more dubious of drawing any conclusions based
> on the first para.  Do you actually mean pointers or something else
> that
> you'd expect to be implemented sort of like pointers?  Well, that's
> just
> a rhetorical question that I don't really expect an answer to; just
> trying to illustrate how little the first para tells me.
I did mean pointers, I just wrote down the wrong example basically.

>
> By the way, the standard doesn't require copy-in/copy-out; it is just
> that
> that's by far the simplest way to implement some things.  When I read
> the
> first para, my initial thought was that you expected copy-in/copy-out
> to
> happen and had code that depended on that, perhaps even for contiguous
> actual arguments, where many compilers optimize the copies away.  But
> the
> code sample has a noncontiguous actual, so perhaps that wasn't the
> issue.
I realize it doesn't require copy-in/copy-out, that's why I included
the text "...or something like that..." ;-)

Sorry my original example was so wrong.

Drew

========================================
  Dr. Drew McCormack (Kmr. R153)
  Afd. Theoretische Chemie
  Faculteit Exacte Wetenschappen
  Vrije Universiteit Amsterdam
  De Boelelaan 1083
  1081 HV Amsterdam
  The Netherlands

  Email         [log in to unmask]
  Web           www.maniacalextent.com

  Telephone     +31 20 44 47623
  Mobile                +31 6 483 21307
  Fax                   +31 20 44 47629