From 10f6a3add6b4bdd1c83494cad9e9497271fe0922 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 4 Nov 2020 08:49:16 -0700 Subject: Only use stride for final element type A DWARF array type may specify a stride. Currently, the DWARF reader applies this stride to every dimension of an array. However, this seems incorrect to me -- only the innermost array ought to use the stride, while outer arrays should compute a stride based on the size of the inner arrays. This patch arranges to apply the stride only to the innermost array type. This fixes a bug noticed when running some Ada tests with -fgnat-encodings=minimal. gdb/ChangeLog 2020-11-04 Tom Tromey * dwarf2/read.c (read_array_type): Only apply stride to innermost array. gdb/testsuite/ChangeLog 2020-11-04 Tom Tromey * gdb.ada/enum_idx_packed.exp: Add test. * gdb.ada/enum_idx_packed/foo.adb (Multi_Access): New variable. * gdb.ada/enum_idx_packed/pck.ads (Short) (Multi_Dimension, Multi_Dimension_Access): New types. --- gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb') diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb index e9f30747167..bc82831bb84 100644 --- a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb +++ b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb @@ -22,6 +22,10 @@ procedure Foo is Small : Small_Table := New_Small_Table (Low => Red, High => Green); Multi : Multi_Table := New_Multi_Table (Red, Green, Low, Medium); Multi_Multi : Multi_Multi_Table := New_Multi_Multi_Table (1, 2, 1, 7, 1, 10); + Multi_Access : Multi_Dimension_Access + := new Multi_Dimension'(True => (1, 1, 2, 3, 5), + False => (8, 13, 21, 34, 55)); + begin Do_Nothing (Full'Address); -- STOP Do_Nothing (Primary'Address); @@ -29,4 +33,5 @@ begin Do_Nothing (Small'Address); Do_Nothing (Multi'Address); Do_Nothing (Multi_Multi'Address); + Do_Nothing (Multi_Access'Address); end Foo; -- cgit v1.2.1