aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-06-10 08:59:05 +0200
committerTom de Vries <tdevries@suse.de>2022-06-10 08:59:05 +0200
commit6a72edd8e26c670bbdce7aeae3c0c8f793fc8612 (patch)
tree344f3dddc853a99bed6d77339678f7673c7e48c7
parent84860e85919f7f09328ae1f84303435ff2e6ee64 (diff)
downloadgdb-6a72edd8e26c670bbdce7aeae3c0c8f793fc8612.zip
gdb-6a72edd8e26c670bbdce7aeae3c0c8f793fc8612.tar.gz
gdb-6a72edd8e26c670bbdce7aeae3c0c8f793fc8612.tar.bz2
[gdb/testsuite] Fix XPASS with gcc-12 in gdb.base/vla-struct-fields.exp
With gcc-12, I get for test-case gdb.base/vla-struct-fields.exp: ... (gdb) print inner_vla_struct_object_size == sizeof(inner_vla_struct_object)^M $7 = 1^M (gdb) XPASS: gdb.base/vla-struct-fields.exp: size of inner_vla_struct_object ... Fix this by limiting the xfailing to gcc-11 and earlier. Also, limit the xfailing to the equality test. Tested on x86_64-linux.
-rw-r--r--gdb/testsuite/gdb.base/vla-struct-fields.exp22
1 files changed, 17 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.base/vla-struct-fields.exp b/gdb/testsuite/gdb.base/vla-struct-fields.exp
index 384d688..eeee6b8 100644
--- a/gdb/testsuite/gdb.base/vla-struct-fields.exp
+++ b/gdb/testsuite/gdb.base/vla-struct-fields.exp
@@ -60,8 +60,20 @@ gdb_test "print vla_struct_object_size == sizeof(vla_struct_object)" \
gdb_test "print vla_union_object_size == sizeof(vla_union_object)" \
" = 1" "size of vla_union_object"
-# Fails due to incorrect debugging information generated by GCC.
-setup_xfail "*-*-*"
-gdb_test \
- "print inner_vla_struct_object_size == sizeof(inner_vla_struct_object)" \
- " = 1" "size of inner_vla_struct_object"
+set a -1
+gdb_test_multiple "print inner_vla_struct_object_size" "" {
+ -re -wrap " = ($decimal)" {
+ set a $expect_out(1,string)
+ }
+}
+set b -1
+gdb_test_multiple "print sizeof(inner_vla_struct_object)" "" {
+ -re -wrap " = ($decimal)" {
+ set b $expect_out(1,string)
+ }
+}
+if { [test_compiler_info "gcc-*"] && [gcc_major_version] <= 11 } {
+ # Fails due to incorrect debugging information generated by GCC.
+ setup_xfail "*-*-*"
+}
+gdb_assert {$a == $b} "size of inner_vla_struct_object"