(j3.2006) Storage_size ??

Rafik Zurob rzurob
Mon Jul 29 10:53:18 EDT 2013

For us, since the type parameter values are known at compile time, the 
program is transformed into something like:

type :: _xlf0x
  integer :: array(4, 4)
end type
type(_xlf0x) :: xx

and no dope vector or runtime allocation is used.  So if we had 
storage_size, we would return sizeof(integer) * 16.

Option 1:  I think we'd agree that we shouldn't return the size of the 
dope vector in this case:
integer, allocatable :: x
integer, pointer :: y
print *, storage_size(x), storage_size(y)
so that discounts option 1.

Option 2, I think if (and only if) the implementation places the type 
parameters inside the object (as opposed to the dope vector), storage_size 
should include it.  I assume storage_size would be used to calculate 
buffer sizes, and so it needs to reflect the actual sizes used by the 
implementation.  This is similar to how padding is included in the 
storage_size result.

In our implementation, a dope vector is used when there are deferred or 
assumed length parameters.  The type parameter values are part of the dope 
vector, not the object.  So for an implementation like ours, I think the 
result value should not include the type parameters.

Option 3:  I don't think there is a strong case for disallowing 
storage_size on parameterized types.  The actual storage size is known at 
compile time when we don't have assumed or deferred parameters and is 
always known at runtime.



j3-bounces at mailman.j3-fortran.org wrote on 26/07/2013 01:43:23 PM:

> From: Bill Long <longb at cray.com>
> To: fortran standards email list for J3 <j3 at j3-fortran.org>, 
> Date: 26/07/2013 01:40 PM
> Subject: (j3.2006) Storage_size ??
> Sent by: j3-bounces at mailman.j3-fortran.org
> suppose I have
> Type :: x (M)
>     Integer,len:: M
>     Integer:: array(M,M)
> Endtype
> Type(x(4))::xx
> What is returned by STORAGE_SIZE(xx) ?
> Option 1: The size of a dope vector (since the implementation always 
> allocates components sized by type parameters on the heap, hence 
> represented by a dv).
> Option 2: The size of one integer (m) + 16 * size of an integer = 17*4 . 

>   (Even though this has no relationship to the contiguous memory layout 
> of xx.)
> Option 3: Storage_size should not be applicable for parameterized 
> derived types. This is an oversight in the standard.
> Cheers,
> Bill
> -- 
> Bill Long                                           longb at cray.com
> Fortran Technical Support    &                 voice: 651-605-9024
> Bioinformatics Software Development            fax:   651-605-9142
> Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

More information about the J3 mailing list