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 c++/28907] New: Wrong pointer cast with multiple inheritance Date: Fri, 18 Feb 2022 16:49:44 +0000 [thread overview] Message-ID: <bug-28907-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=28907 Bug ID: 28907 Summary: Wrong pointer cast with multiple inheritance Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: c++ Assignee: unassigned at sourceware dot org Reporter: simark at simark dot ca Target Milestone: --- $ cat test.cpp struct Base1 { int b1 = 0x1111; }; struct Base2 { int b2 = 0x2222; }; struct Derived : public Base1, Base2 { int d = 0x3333; }; int main() { Derived d; return 0; } $ g++ test.cpp -g3 -O0 $ DEBUGINFOD_URLS= ./gdb -nx -q --data-directory=data-directory a.out -ex "b 15" -ex r Reading symbols from a.out... Breakpoint 1 at 0x1165: file test.cpp, line 15. Starting program: /home/simark/build/binutils-gdb/gdb/a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". Breakpoint 1, main () at test.cpp:15 15 return 0; (gdb) p &d $1 = (Derived *) 0x7fffffffdcfc (gdb) p (Base2 *) &d $2 = (Base2 *) 0x7fffffffdd00 (gdb) p (Derived *) (Base2 *) &d $3 = (Derived *) 0x7fffffffdcf8 Pretty sure that $1 and $3 should be equal. Might be related to https://sourceware.org/bugzilla/show_bug.cgi?id=20285. Not quite the same, but it might be the same root cause. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-02-18 16:49 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-18 16:49 simark at simark dot ca [this message] 2022-02-24 18:34 ` [Bug c++/28907] " ssbssa at sourceware dot org 2022-04-02 16:14 ` tromey at sourceware dot org 2022-04-18 15:45 ` cvs-commit at gcc dot gnu.org 2022-04-18 15:46 ` tromey at sourceware dot org
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-28907-4717@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: linkBe 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).