public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/18861] 'reinterpret_cast' in gdb seems to be doing a 'static_cast'.
Date: Wed, 20 Mar 2024 17:02:54 +0000 [thread overview]
Message-ID: <bug-18861-4717-rUbddEQ7Ic@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-18861-4717@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18861
--- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=23cdd9431ad424b092c65419d47ef4601168a1c9
commit 23cdd9431ad424b092c65419d47ef4601168a1c9
Author: Hannes Domani <ssbssa@yahoo.de>
Date: Wed Mar 20 18:02:06 2024 +0100
Fix reinterpret_cast for classes with multiple inheritance
Currently a reinterpret_cast may change the pointer value if
multiple inheritance is involved:
```
(gdb) p r
$1 = (Right *) 0x22f75c
(gdb) p reinterpret_cast<LeftRight*>(r)
$2 = (LeftRight *) 0x22f758
```
It's because value_cast is called in this case, which automatically
does up- and downcasting.
Fixed by simply using the target pointer type in a copy of the
original value:
```
(gdb) p r
$1 = (Right *) 0x3bf87c
(gdb) p reinterpret_cast<LeftRight*>(r)
$2 = (LeftRight *) 0x3bf87c
```
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18861
Approved-By: Tom Tromey <tom@tromey.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
next prev parent reply other threads:[~2024-03-20 17:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 21:27 [Bug gdb/18861] New: " cs120hcc at yahoo dot com
2015-08-21 21:27 ` [Bug gdb/18861] " cs120hcc at yahoo dot com
2023-12-23 12:21 ` [Bug c++/18861] " ssbssa at sourceware dot org
2024-03-20 17:02 ` cvs-commit at gcc dot gnu.org [this message]
2024-03-20 17:04 ` ssbssa 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-18861-4717-rUbddEQ7Ic@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).