public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/26550] Object of class with virtual base classes printed incorrectly (gdb.cp/ambiguous.exp)
Date: Wed, 10 Nov 2021 16:52:08 +0000	[thread overview]
Message-ID: <bug-26550-4717-6IOtHWLYRA@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26550-4717@http.sourceware.org/bugzilla/>

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

B. Larsen <blarsen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blarsen at redhat dot com

--- Comment #2 from B. Larsen <blarsen at redhat dot com> ---
Hi! I've stated looking at this bug, and I have a new insight

> And with the following we see how GDB is clearly confusing the offset of _vptr.KV
> with the offset of A1:
> (gdb) print /x jva1
> $1 = {<KV> = {<A1> = {x = 0x2, y = 0x16}, _vptr.KV = 0x555555557b88 <vtable for > JVA1+24>, i = 0x457}, ......}
>                                                      ^^^^^^^^^^^^^^
> (gdb) print /x jva1.KV::x
> $2 = 0x55557b88
>      ^^^^^^^^^^
> (gdb) print /x jva1.KV::y
> $3 = 0x5555

I think the problem runs a little deeper because of the following tests:

(gdb) print &jva1.KV::x
$1 = (int *) 0x7fffffffe0f0

(gdb) print &jva1.LV::x
$2 = (int *) 0x7fffffffe100

(gdb) p &jva1
$3 = (JVA1 *) 0x7fffffffe0f0

and if I understand virtual inheritance correctly (and dissassembly of the
code), $1 and $2 should be the same, both 0x7f...fe100

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

  parent reply	other threads:[~2021-11-10 16:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 20:06 [Bug c++/26550] New: " palves at redhat dot com
2020-10-12 17:12 ` [Bug c++/26550] " cvs-commit at gcc dot gnu.org
2021-11-10 16:52 ` blarsen at redhat dot com [this message]
2021-11-25 18:28 ` blarsen at redhat dot com

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-26550-4717-6IOtHWLYRA@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).