From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E9E43858C35; Tue, 19 Mar 2024 14:57:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E9E43858C35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710860256; bh=gN9ObKFHPyRSMbo+e4OkXxA8F/Aa2jUuJKnU+PjgSDQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=D29BjCFyCS4d5+kZWcU4QE5U7E6BdllTYkN3wAfUQE+Q4TYv+p92ToVi3H/+xW1uJ OiVqgMy3BBVc5kiGWNTOmLZK9JwJGPD0btO3F1aJc/zpBmbgroNRYHMlbMJ/BTyHhQ zjw4w0QM6rE07vxeyw9aJKyoFz9sRv/yBL3emUJQ= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug build/31399] Build fails on macOS: error: cannot cast 'tui_win_info *' to 'tui_cmd_window *' via virtual base 'tui_win_info' Date: Tue, 19 Mar 2024 14:57:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: build X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 15.1 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31399 --- Comment #4 from Sourceware Commits --- The master branch has been updated by Andrew Burgess : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7d18eb9983b0= 0455fd2f3100d4de2772c3f656ad commit 7d18eb9983b00455fd2f3100d4de2772c3f656ad Author: Andrew Burgess Date: Wed Mar 6 17:28:48 2024 +0000 gdb: use static_cast in gdb::checked_static_cast This commit: commit 6fe4779ac4b1874c995345e3eabd89cb1a05fbdf Date: Sat Feb 24 11:00:20 2024 +0100 [gdb/build] Fix static cast of virtual base addressed an issue where GDB would not compile in production mode due to a use of gdb::checked_static_cast. The problem was that we were asking GDB to cast from a virtual base class to a sub-class, this works fine when using dynamic_cast, but does not work with static_cast. The gdb::checked_static_cast actually uses dynamic_cast under the hood in development mode in order to ensure that the cast is valid, while in a production build we use static_cast as this is more efficient. What this meant however, was that when gdb::checked_static_cast was used to cast from a virtual base class, the dynamic_cast of a non-production build worked fine, while the production build's static_cast caused a build failure. However, the gdb::checked_static_cast function already contains some static_assert calls that are intended to catch any issues with invalid type casting, the goal of these asserts was to prevent issues like this: the build only failing in production mode. Clearly the current asserts are not enough. I don't think there is a std::is_virtual_base type trait check, so what I propose instead is that in non-production mode we also make use of static_cast. This will ensure that any errors that crop up in production mode should also be revealed in non-production mode, and should catch issues like this in the future. There should be no user visible changes after this commit. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31399 Co-Authored-By: Simon Marchi --=20 You are receiving this mail because: You are on the CC list for the bug.=