relaxmike wrote:
| On 29 avr, 11:26, nos...@[EMAIL PROTECTED]
(Richard Maine) wrote:
|| That is *A* difference. It is certainly not *THE* difference. [...]
|| No. [...]
|| Not typically. [...]
|| No. [...]
|
| Despite appearances, I think that we do not disagree that much !
<snip>
| This is an abstract :
|
| extra_mem ()
| {
| struct array1_integer(kind=4) mydata;
| static integer(kind=4) options.0[7] = {68, 255, 0, 0, 0, 1, 0};
| mydata.data = 0B;
| _gfortran_set_options (7, (void *) &options.0);
| {
| void * D.567;
| mydata.dtype = 265;
| mydata.dim[0].lbound = 1;
| mydata.dim[0].ubound = 10;
| mydata.dim[0].stride = 1;
| [... with a "D.568 = __builtin_malloc (40);" and "D.567 = D.568;"]
| mydata.data = D.567;
| mydata.offset = -1;
| [...]
|
| We can see the dtype (data type ?), the lower bound 1, the upper
| bound 10 (what is stride ? what is offset) and the memory location
| is probably in mydata.data.
"Stride" is the last thingo in the array triplet, i.e. index
difference between subsequent array elements:
http://www-unix.mcs.anl.gov/dbpp/text/node84.html
"Offset" is an internal thingo, which is not essential, but can
speed up calculation. The point is to calculate it in advance,
so you can find the address of element x = A(1,2,3) faster, like:
*x = A(offset + 1 + 2*dim[1].ubound + 3*dim[2].ubound)
Without offset, you would have to involve lbounds into play
in general case, and every array access would have to involve
a couple of extra operations. (My math above is almost certainly
wrong, but you get the idea).
| If we... compare the intermediate code with allocatable and pointer
| versions, one can see that only the "allocatable" version contains
| the following code, near the end of the source :
|
| if (mydata.data != 0B)
| {
| __builtin_free (mydata.data);
| }
| mydata.data = 0B;
|
| which clearly shows how gfortran deallocate the array
| before exiting from the subroutine.
Exactly. Just as expected.
--
Jugoslav
___________
www.xeffort.com
Please reply to the newsgroup.
You can find my real e-mail on my home page above.


|