From: Paul Floyd Date: Tue, 5 Jul 2022 10:53:34 +0000 (+0200) Subject: Fix reading dwarf info for arrays with lower bound and count X-Git-Tag: VALGRIND_3_20_0~22 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=498b5c4286ec631bec43b8c359e3ff00c00b90e7;p=valgrind.git Fix reading dwarf info for arrays with lower bound and count There was an out-by-one error, the upper bound was being set to count whereas it should be count - 1. This was causing drd/tests/atomic_var to fail because the g_dummy array seemed to overlap the following s_y variable. This seems only to have been caused by clang, not GCC, which presumably supplies lower and upper bound rather than lower bound and count. --- diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 96bd21f7f7..b1a709e6a0 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -4571,7 +4571,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, boundE.Te.Bound.knownL = True; boundE.Te.Bound.knownU = True; boundE.Te.Bound.boundL = lower; - boundE.Te.Bound.boundU = lower + count; + boundE.Te.Bound.boundU = lower + count - 1; } else { /* FIXME: handle more cases */ goto_bad_DIE;