From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libdw/30085] Negative strides in dwarf_aggregate_size
Date: Tue, 21 Feb 2023 16:03:27 +0000 [thread overview]
Message-ID: <bug-30085-10460-WVGFUFmbFV@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30085-10460@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=30085
--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
I asked around and John DelSignore came up with the following fortran example:
= array.f95 =
program f_prog
integer*4, allocatable, target, dimension (:,:) :: big_array
integer, dimension (:,:), pointer :: neg_array
allocate (big_array(2000,1000))
neg_array => big_array(2000:1:-1,1000:1:-1)
end program f_prog
So, neg_array is a pointer to an array section where the elements of big_array
are reversed. That is, neg_array(x,y) references big_array(2000-x+1,1000-y+1).
In this example, the stride makes us go "backwards" into the array.
But note that gfortran -g array.f95 produces DW_FORM_exprlocs for the
DW_AT_byte_stride because almost all attributes of the array are dynamic at
runtime:
[ c9] array_type abbrev: 10
ordering (data1) col_major (1)
data_location (exprloc)
[ 0] push_object_address
[ 1] deref
allocated (exprloc)
[ 0] push_object_address
[ 1] deref
[ 2] lit0
[ 3] ne
type (ref4) [ 72]
sibling (ref4) [ 106]
[ db] subrange_type abbrev: 1
lower_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 48
[ 3] deref
upper_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 56
[ 3] deref
byte_stride (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 40
[ 3] deref
[ 4] push_object_address
[ 5] plus_uconst 32
[ 7] deref
[ 8] mul
[ f0] subrange_type abbrev: 1
lower_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 72
[ 3] deref
upper_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 80
[ 3] deref
byte_stride (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 64
[ 3] deref
[ 4] push_object_address
[ 5] plus_uconst 32
[ 7] deref
[ 8] mul
[ 106] array_type abbrev: 11
ordering (data1) col_major (1)
data_location (exprloc)
[ 0] push_object_address
[ 1] deref
associated (exprloc)
[ 0] push_object_address
[ 1] deref
[ 2] lit0
[ 3] ne
type (ref4) [ 72]
[ 114] subrange_type abbrev: 1
lower_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 48
[ 3] deref
upper_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 56
[ 3] deref
byte_stride (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 40
[ 3] deref
[ 4] push_object_address
[ 5] plus_uconst 32
[ 7] deref
[ 8] mul
[ 129] subrange_type abbrev: 1
lower_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 72
[ 3] deref
upper_bound (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 80
[ 3] deref
byte_stride (exprloc)
[ 0] push_object_address
[ 1] plus_uconst 64
[ 3] deref
[ 4] push_object_address
[ 5] plus_uconst 32
[ 7] deref
[ 8] mul
Something dwarf_aggregate_size doesn't handle. And even if it could handle the
expression, it doesn't know the object address or how to deref memory...
--
You are receiving this mail because:
You are on the CC list for the bug.
next prev parent reply other threads:[~2023-02-21 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 13:06 [Bug libdw/30085] New: " thaines.astro at gmail dot com
2023-02-15 20:18 ` [Bug libdw/30085] " mark at klomp dot org
2023-02-21 16:03 ` mark at klomp dot org [this message]
2023-02-21 16:43 ` thaines.astro at gmail dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-30085-10460-WVGFUFmbFV@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).