This is the mail archive of the
dwarf2@corp.sgi.com
mailing list for the dwarf2 project.
Re: 991108.11 Fortran 90 arrays - a couple of questions
- To: "Knott, Martin" <martin at epc dot co dot uk>
- Subject: Re: 991108.11 Fortran 90 arrays - a couple of questions
- From: James Cownie <jcownie at etnus dot com>
- Date: Mon, 10 Apr 2000 13:40:34 +0100
- cc: "'brender at gemevn dot zko dot dec dot com'" <brender at gemevn dot zko dot dec dot com>, "'dwarf2 at corp dot sgi dot com'" <dwarf2 at corp dot sgi dot com>
- Reply-To: James Cownie <jcownie at etnus dot com>
> program main
>
> type t_1
> integer a
> real b
> end type
>
> type(t_1), target, dimension(3,2) :: s_1
> integer, pointer, dimension(:,:) :: x
>
> x => s_1%a ! (1)
>
> end program main
>
> There are two issues regarding the use of DW_AT_stride that this example
> might clarify:
>
> a) For pointers to arrays where the distance between successive elements of an
> array is different from the actual element size as defined by the element
> type DIE.
> b) For Multi-dimensional arrays, where the distance between successive elements
> along a given dimension is required.
To make it even _more_ interesting, you might consider changing
your example marginally to something like this :-
program main
type t_1
complex a
integer b
end type
type(t_1), target, dimension(3,2) :: s_1
complex, pointer, dimension(:,:) :: x
x => s_1%a ! (1)
end program main
In this case, the distance between the s_1%a elements will very likely
be _less_ than the size of a complex variable. (It is an example like
this which demonstrates why the stride must be specified in bytes,
rather than the size of the scalar object).
> Where the DW_AT_stride expressions result in the number of bytes between
> successive elements along the given dimension,
>
> stride_1 = multiplier_1*scale_factor,
> stride_2 = multiplier_2*scale_factor.
>
> So that the address of x(i,j) can be calculated as:
>
> address of x(i,j) = base_address
> + stride_1*(i - lower_bound_1)
> + stride_2*(j - lower_bound_2)
>
> Have I got the right interpretation of DW_AT_stride?
Exactly.
-- Jim
James Cownie <jcownie@etnus.com>
Etnus, Inc. +44 117 9071438
http://www.etnus.com