public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/27787] FAIL: gdb.python/flexible-array-member.exp: python print(zs['items'].type.range())
Date: Fri, 30 Apr 2021 13:15:37 +0000	[thread overview]
Message-ID: <bug-27787-4717-xeKiww8cSO@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27787-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27787

--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
Ok, so we could simply fix the test to accept both values (see patch below).

But do you think we should address the underlying issue and make GDB output
something consistent in that case, whatever the compiler and the method used to
specify the flexible array member?

- Choose either 0 or -1 to indicate "there's no high bound" and output that
consistently.  It would be a user-visible behavior change for some cases but
not others.
- Emit "None" to indicate "there's no high bound".  This is probably a more
Pythonic way of doing things, but the downside is that it's a user-visible
change for all cases involved.


>From 67eeb4e645c7c6d02f642bb2864ad3286665b6af Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>
Date: Fri, 30 Apr 2021 09:12:35 -0400
Subject: [PATCH] fix

Change-Id: Ie4e06d99fe9315527f04577888f48284d649ca4c
---
 gdb/testsuite/gdb.python/flexible-array-member.exp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.python/flexible-array-member.exp
b/gdb/testsuite/gdb.python/flexible-array-member.exp
index 349670cb7e7..38c8ee5f21f 100644
--- a/gdb/testsuite/gdb.python/flexible-array-member.exp
+++ b/gdb/testsuite/gdb.python/flexible-array-member.exp
@@ -76,9 +76,10 @@ gdb_test "python print(zso\['items'\] ==
zso\['items'\]\[0\].address)" "True"
 gdb_test "python print(zso\['items'\]\[0\].address + 1 ==
zso\['items'\]\[1\].address)" "True"

 # Verify the range attribute.  It looks a bit inconsistent that the high bound
-# is sometimes 0, sometimes -1, but that's what GDB produces today, so that's
-# what we test.
+# is sometimes 0, sometimes -1.  It depends on the way the flexible array
+# member is specified and on the compiler version (the debug info is
+# different).  But that's what GDB produces today, so that's what we test.

 gdb_test "python print(ns\['items'\].type.range())" "\\(0, 0\\)"
-gdb_test "python print(zs\['items'\].type.range())" "\\(0, -1\\)"
-gdb_test "python print(zso\['items'\].type.range())" "\\(0, -1\\)"
+gdb_test "python print(zs\['items'\].type.range())" "\\(0, (0|-1)\\)"
+gdb_test "python print(zso\['items'\].type.range())" "\\(0, (0|-1)\\)"
-- 
2.31.1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-04-30 13:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 18:22 [Bug testsuite/27787] New: " vries at gcc dot gnu.org
2021-04-28 19:23 ` [Bug testsuite/27787] " simark at simark dot ca
2021-04-28 19:32 ` vries at gcc dot gnu.org
2021-04-28 20:45 ` simark at simark dot ca
2021-04-30  9:42 ` vries at gcc dot gnu.org
2021-04-30 13:15 ` simark at simark dot ca [this message]
2021-05-04  9:22 ` vries at gcc dot gnu.org
2021-05-04 15:28 ` simark at simark dot ca

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=bug-27787-4717-xeKiww8cSO@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).