From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8B13F385B539; Tue, 21 Feb 2023 16:03:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B13F385B539 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676995408; bh=G38KJbyEq9Y9sphZNyEjvxGXHwSvbwfuh5BHP8jK14o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fqRl4Hb0awUUKi+wqDZU6NLYSUU+D9KhV2uY+s0YaMDtc8/sW2k/UaVhOpnNZeEBg 22em/XVmdZnJzBY1JYfTb/3SvRjKJftLKg7ZVCyQ9Dn60NfLrFpTUlDDXQ3zkl0fQL I+W40GPevfVT6ttIQoAB5L4aYdbTCNUmvOTN9+Wo= From: "mark at klomp dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: libdw X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30085 --- Comment #2 from Mark Wielaard --- I asked around and John DelSignore came up with the following fortran examp= le: =3D array.f95 =3D program f_prog integer*4, allocatable, target, dimension (:,:) :: big_array integer, dimension (:,:), pointer :: neg_array allocate (big_array(2000,1000)) neg_array =3D> 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_ar= ray 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)=20 [ 0] push_object_address [ 1] deref allocated (exprloc)=20 [ 0] push_object_address [ 1] deref [ 2] lit0 [ 3] ne type (ref4) [ 72] sibling (ref4) [ 106] [ db] subrange_type abbrev: 1 lower_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 48 [ 3] deref upper_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 56 [ 3] deref byte_stride (exprloc)=20 [ 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)=20 [ 0] push_object_address [ 1] plus_uconst 72 [ 3] deref upper_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 80 [ 3] deref byte_stride (exprloc)=20 [ 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)=20 [ 0] push_object_address [ 1] deref associated (exprloc)=20 [ 0] push_object_address [ 1] deref [ 2] lit0 [ 3] ne type (ref4) [ 72] [ 114] subrange_type abbrev: 1 lower_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 48 [ 3] deref upper_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 56 [ 3] deref byte_stride (exprloc)=20 [ 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)=20 [ 0] push_object_address [ 1] plus_uconst 72 [ 3] deref upper_bound (exprloc)=20 [ 0] push_object_address [ 1] plus_uconst 80 [ 3] deref byte_stride (exprloc)=20 [ 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... --=20 You are receiving this mail because: You are on the CC list for the bug.=