From b6a6aa07c5bd53d19c33db1f7c9645fc99b66e1b Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 4 Dec 2020 13:36:48 +0100 Subject: [PATCH] [gdb/tdep] Handle static field in i386_16_byte_align_p When running test-case on gdb.cp/many-args.exp with target board unix/-m32, I run into: ... (gdb) p check_val (ref_val, ref_val, ... , ref_val, ref_val)^M $1 = false^M (gdb) FAIL: gdb.cp/many-args.exp: check passing many structures ... The test source contains struct ss: ... typedef int v4si __attribute__ ((vector_size (16))); struct ss { static v4si static_field; unsigned char aa; }; ... and i386_16_byte_align_p returns true for this type. Fix this by skipping static fields in i386_16_byte_align_p. Tested on x86_64-linux. gdb/ChangeLog: 2020-12-04 Tom de Vries PR tdep/27007 * i386-tdep.c (i386_16_byte_align_p): Skip static fields. --- gdb/ChangeLog | 5 +++++ gdb/i386-tdep.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 75d7422559d..bbd50291bb4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-12-04 Tom de Vries + + PR tdep/27007 + * i386-tdep.c (i386_16_byte_align_p): Skip static fields. + 2020-12-03 Simon Marchi PR gdb/26876 diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 00de4e1ccb9..ad02ad679bc 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2644,6 +2644,8 @@ i386_16_byte_align_p (struct type *type) int i; for (i = 0; i < type->num_fields (); i++) { + if (field_is_static (&type->field (i))) + continue; if (i386_16_byte_align_p (type->field (i).type ())) return 1; } -- 2.30.2