Re: ALLOCATE and contiguous memory
From: James Giles (jamesgiles_at_worldnet.att.net)
Date: 10/12/04
- Next message: Richard E Maine: "Re: weird I/O problem with g77"
- Previous message: glen herrmannsfeldt: "Re: weird I/O problem with g77"
- In reply to: Richard E Maine: "Re: ALLOCATE and contiguous memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 12 Oct 2004 18:36:03 GMT
Richard E Maine wrote:
...
> But for the kind of architecture where one can ask simply about
> contiguity without needing to first write a thesis explaining
> what the term implies, then yes, regular arrays are stored in
> contiguous memory, and allocatables just the same.
All true (including the parts I elided), but beware! If the array
is a dummy argument, especially if declared as an assumed shape
array, and the corresponding actual argument is an array slice,
then the array will possibly (even probably) not be contiguous,
even though it doesn't have the pointer attribute.
I didn't see it mentioned whether the array in question actually
has the ALLOCATABLE attribute in the context where the call
to the C routine is made, or whether it was merely allocated
elsewhere and passed into the context where the C routine is
called. Hence the possible relevance of this issue.
Note also that if your compiler "thinks" the C routine is a Fortran
routine and your call uses array slice syntax, the compiler may be
passing a descriptor that C won't understand. Probably more details
about the OP's code and what symptoms are observed would be
useful.
-- J. Giles "I conclude that there are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies." -- C. A. R. Hoare
- Next message: Richard E Maine: "Re: weird I/O problem with g77"
- Previous message: glen herrmannsfeldt: "Re: weird I/O problem with g77"
- In reply to: Richard E Maine: "Re: ALLOCATE and contiguous memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|