From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hAgGKR3hgGmeiiQAWB0awg (envelope-from ) for ; Mon, 02 Feb 2026 12:38:37 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OSuH6HaO; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9A2EA1E0BA; Mon, 02 Feb 2026 12:38:37 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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 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 2BF821E08D for ; Mon, 02 Feb 2026 12:38:37 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9E9A14BB58E1 for ; Mon, 2 Feb 2026 17:38:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E9A14BB58E1 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OSuH6HaO Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 57E1E4BB58B1 for ; Mon, 2 Feb 2026 17:38:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57E1E4BB58B1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57E1E4BB58B1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770053891; cv=none; b=Iw15FCoF95Qce9NgHxfoLWzSud/ZjnyVy0iyHEX3r0k/HvH/zsziRzyuWYYXP43zZFFbCuT4IVoeaXz0NstDnVi5aMpsBrUVl1QSs3NLLYo8aawjRZnI35UEApZqMWi0IgWnac9fXSJhsm2ejYNVdYweXQwZiZVbh6SdqMKuKwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770053891; c=relaxed/simple; bh=W5wcVLhZLSKE9OQ9WfNoqYVgRmdv5zjAGO7kTup5GWU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=qrToXMWx5bbu9idSbujoi34wG+PIPi02IabkdeNgrUekkwxjGJQu2elx2JvxEWCwV1JyeziVbKsEYwIRpfs1AIl4HbNhJMukB1PUtl2X8TuI3R7U/is18oVDwIPshpGUHfMf4RFiOBwdPHLPfTBA0YfSg4bWapGo9T36r3xd4S0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57E1E4BB58B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770053891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a39jpIP18l6lxzIuMyBTL1KV35pRjzwwrqLVPCOVTv4=; b=OSuH6HaO1nyV3KqyUXovnFE+ChvBYP+Gm0LiTOQfhpgi8my9PJafdnHDtL/Q6wjAgDaBvA KJSVa9rlXj6lhWxs+SHGSSJOM7AYEf+bXJmSHwYk594mk7iwFI94QyZ9DkNZ8HCywXBQtq qAIJ73/vQRz5P/5QxZ+YlG7RsXWjVIQ= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-zu2ZY6XNP_Wf0tvMfVAm3w-1; Mon, 02 Feb 2026 12:38:09 -0500 X-MC-Unique: zu2ZY6XNP_Wf0tvMfVAm3w-1 X-Mimecast-MFC-AGG-ID: zu2ZY6XNP_Wf0tvMfVAm3w_1770053889 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 231C919560B0 for ; Mon, 2 Feb 2026 17:38:09 +0000 (UTC) Received: from f42-mesa-1 (unknown [10.22.64.64]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8EDF719560B2 for ; Mon, 2 Feb 2026 17:38:08 +0000 (UTC) Date: Mon, 2 Feb 2026 10:38:06 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: tighten assertions in set_type_vptr_* Message-ID: <20260202103806.31b501b7@f42-mesa-1> In-Reply-To: <20260126155550.122509-1-simon.marchi@efficios.com> References: <20260126155550.122509-1-simon.marchi@efficios.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: d9xXtRQfKdM-DQfvEwjT1vdW8lFCQlD8l_jiDBdKYfI_1770053889 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII 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 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