This is the mail archive of the
mailing list for the elfutils project.
[Bug libdw/22546] New: dwarf_aggregate_size() doesn't work for multi-dimensional arrays
- From: "sourceware at dima dot secretsauce.net" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Mon, 04 Dec 2017 23:05:39 +0000
- Subject: [Bug libdw/22546] New: dwarf_aggregate_size() doesn't work for multi-dimensional arrays
- Auto-submitted: auto-generated
Bug ID: 22546
Summary: dwarf_aggregate_size() doesn't work for
Assignee: unassigned at sourceware dot org
Reporter: sourceware at dima dot secretsauce.net
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
Hi. I'm observing that dwarf_aggregate_size() returns bogus results when
looking at double-dimensional arrays. For instance, looking at
It says the aggregate is 64-bytes long instead of 120. The bug is that it ends
up computing (3+5)*8 instead of 3*5*8.
I'm attaching a simple test case. It loads the current process's debug
information, and prints out the size of dd, defined as above. It shows the
dima@fatty:/tmp$ gcc -g -ldw -lelf dwarf_aggregate_size_bug.c -o
Found DIE for 'dd'. size: 64
I'm using libelf1 0.168-1 on Debian/sid, although at least version 0.170 has
the bug too.
I'm attaching a proof-of-concept patch to solve this. Note that this patch
isn't final: previously we would compute a separate stride for each dimension,
while the patch only computes the stride once. I don't know what case
specifically that is meant to handle. Tests pass before and after.
If for some reason dwarf_aggregate_size() isn't meant to be used this way, then
it should still be changed to fail in a more obvious way. Answering 64 here is
NEVER the right answer.
You are receiving this mail because:
You are on the CC list for the bug.