From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sUH7A+DpgGmPlCQAWB0awg (envelope-from ) for ; Mon, 02 Feb 2026 13:16:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1770056160; bh=ygUfEamABJwFd8yrqAuqQjCLyUg2tfKFEsCTzrL7WhU=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=E0f4nW153rUJRZmJehSVH9Sh0kkJTI2v+EPZ+piBSans/EmVjyRM5wU6qqydvoSnl a+02YM/9H4v9pXE9RjA1VwPaP5Ou0Hy7WPYd98/qwCsvS38Ifb52dntnsABlvWYubi Cou1DAZelrgs48BCQQa6PMxZ3WB+giCm2Vbp5u/s= Received: by simark.ca (Postfix, from userid 112) id 0C40B1E0BA; Mon, 02 Feb 2026 13:16:00 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=SLqpEs0m; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 603BF1E08D for ; Mon, 02 Feb 2026 13:15:59 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C682A4BB58EB for ; Mon, 2 Feb 2026 18:15:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C682A4BB58EB Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=SLqpEs0m Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CBA044BB58B1 for ; Mon, 2 Feb 2026 18:15:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBA044BB58B1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBA044BB58B1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770056112; cv=none; b=kJ8QgzTGwXH5TEhWJwAfZC6mht2RQYVAqb0pr4+I0g3aCRyl/askzvWisxkqECNFPDNoiZaFRvRUDHTRLmabgCj4Uf0hxeS3XW/wjKlxAUqHGcgiAUEdCAnY89ecMqWkRvRGNZ9x104eMhGOQBzhVgLu16FLKLxnEiZFPJcga9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770056112; c=relaxed/simple; bh=ygUfEamABJwFd8yrqAuqQjCLyUg2tfKFEsCTzrL7WhU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=NC26u1wo5uvPP3jdPQNsexXmYiWxEOkvt9o/nZCTUAZqC5VDZXYZcDnlvxX1OjXI+RAPju6ubtpUa3zIawOtGEjnTPqX9MdYG2qwmoqpFI3zG7xCRAZYlAATmSuA+gEGDsdIPjzFF4m+GaYRbBJdAvpHY3DGh6db879QbbIdBvM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBA044BB58B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1770056111; bh=ygUfEamABJwFd8yrqAuqQjCLyUg2tfKFEsCTzrL7WhU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SLqpEs0mOLsEx9CC+9y2ZtdZ7pmAsAoMVpZa9kBSiqx2FJrDDWxZlmPATiE9JKsFD C6HypLFA7PEExDB2Ma972HPBSKrYqp1cxFwvd1xM3NQUwHjobOB/AkTy3cZxPNj75N aWM8QoII7K/uOSnx5nf8grTpiItjkoM/8cgdtFNc= Received: by simark.ca (Postfix) id 3EC751E08D; Mon, 02 Feb 2026 13:15:11 -0500 (EST) Message-ID: Date: Mon, 2 Feb 2026 13:15:10 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: tighten assertions in set_type_vptr_* To: Kevin Buettner , gdb-patches@sourceware.org References: <20260126155550.122509-1-simon.marchi@efficios.com> <20260202103806.31b501b7@f42-mesa-1> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260202103806.31b501b7@f42-mesa-1> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-02-02 12:38, Kevin Buettner wrote: > On Mon, 26 Jan 2026 10:54:00 -0500 > Simon Marchi wrote: > >> From: Simon Marchi >> To: gdb-patches@sourceware.org >> Cc: Simon Marchi >> Subject: [PATCH] gdb: tighten assertions in set_type_vptr_* >> Date: Mon, 26 Jan 2026 10:54:00 -0500 >> >> From: Simon Marchi >> >> In C++, only structures and classes (represented by TYPE_CODE_STRUCT) >> can participate in inheritance. I therefore think it does not make >> sense to allow for TYPE_CODE_UNION in set_type_vptr_basetype and >> set_type_vptr_fieldno. Remove the possibility for the type to be a >> union in these functions. >> >> Also, for the same reason, add an assertion that checks the type of >> basetype in set_type_vptr_basetype. >> >> I did not change the getters (internal_type_vptr_fieldno and >> internal_type_vptr_basetype), because it seems like they are called by >> code that handles similarly both structures and unions. Making those >> stricter would require adding conditions in those callers, which doesn't >> look like an improvement. For unions, they will correctly return an >> "invalid" value. >> >> Change allocate_cplus_struct_type to not use set_type_vptr_fieldno to >> initialize the field to -1, otherwise it would trip the assertion when >> initializing for a union type. > > Makes sense to me... > > Approved-by: Kevin Buettner > Pushed, thanks! Simon