From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E72DF385840C; Mon, 18 Apr 2022 15:45:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E72DF385840C From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug c++/28907] Wrong pointer cast with multiple inheritance Date: Mon, 18 Apr 2022 15:45:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2022 15:45:56 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28907 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom Tromey : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2390419d1cb7= 2882110538e01e5586372df19657 commit 2390419d1cb72882110538e01e5586372df19657 Author: Tom Tromey Date: Sat Apr 2 09:54:40 2022 -0600 Fix C++ cast of derived class to base class PR c++/28907 points out that casting from a derived class to a base class fails in some situations. The problem turned out to be a missing use of value_embedded_offset. One peculiarity here is that, if you managed to construct a pointer-to-derived with an embedded offset of 0, the cast would work -- for example, one of the two new tests here passes without the patch. This embedded offset stuff is an endless source of bugs. I wonder if it's possible to get rid of it somehow. Regression tested on x86-64 Fedora 34. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28907 --=20 You are receiving this mail because: You are on the CC list for the bug.=