public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Fix XPASS with gcc-12 in gdb.base/vla-struct-fields.exp
Date: Fri, 10 Jun 2022 06:59:09 +0000 (GMT)	[thread overview]
Message-ID: <20220610065909.05285386F0EA@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6a72edd8e26c670bbdce7aeae3c0c8f793fc8612

commit 6a72edd8e26c670bbdce7aeae3c0c8f793fc8612
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Jun 10 08:59:05 2022 +0200

    [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.

Diff:
---
 gdb/testsuite/gdb.base/vla-struct-fields.exp | 22 +++++++++++++++++-----
 1 file 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 384d6881779..eeee6b8d6a1 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"


                 reply	other threads:[~2022-06-10  6:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220610065909.05285386F0EA@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).