From patchwork Tue Jul 28 17:07:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Baris" X-Patchwork-Id: 140111 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9258D4BB3BBA for ; Tue, 28 Jul 2026 17:08:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9258D4BB3BBA Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=J0yGQf/M X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazlp170100005.outbound.protection.outlook.com [IPv6:2a01:111:f403:c111::5]) by sourceware.org (Postfix) with ESMTPS id 2A1634BA79B3 for ; Tue, 28 Jul 2026 17:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A1634BA79B3 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A1634BA79B3 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c111::5 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785258496; cv=pass; b=eI9/Ex+bAHn8XYRRcxK/8m/PfNolQdHfo4gAfHDAEMplY1KrtsbcDFJTRk4c2YActd7tjfFb7SCo5eNg46g4kGJ/m5IDtdc/ErJz3xxfvXBalWSrV79DWTTi+ljITMQcpQVxrtctyASbxSJh16NocchZAgHAPCMtyeoZusLvCGU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785258496; c=relaxed/simple; bh=iWuJb7TJQ0wefPwAKkkPUdiGI1Q6rgkhBBnwZ81ykRM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=guhyZ7nqvEOu45YYOVR2804FvRK92aL7wjzPOWsqcKI7JZpogLXPgC67Wbr0aQ9xoHBCDxwCH6YahmyVUVHqkFwRYV+loOY/vm0HqVy6ESDsBgCz9mvOlTx3/pt7Fw/ZrUvi9K2v5Jx9zfR6YPYZcKgr8ithrcGF0Vexdpuq9uA= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=J0yGQf/M DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A1634BA79B3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K1xFZcu6aAd76qZkGl0SDC1hHPnWtQTZdGbbqYs7Ef2y7Eps8+z4Np/B7Cz2zcR2lcoOQMeICbkIVhLpqleHA1+PAnucnyODcMzwU0lj7+t7hPu5ePgKaf+2w6L3pNBjbml4vV8JkE252Xj2iG4s5fsPtyF0s40DZcit4ACegexJ/dp9xTbhnxwE8aH60ZWfUHHQnKTGpCO61mQ+upWPP/o3+ZVICHE3cOXzkitFsCZN1S3w7HdxRVqsETJkxf24+FDXBpICqfxqKb5RrbjZ+hh29/B39eD6bc3uJH5suBGC3lgwFxc92cZiO4AX4lBr2cZPqV8C4YTB85VjXZio0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+nMuCIpAJRtDlH8ppEP94Lim1Y6yTT6BP9CsFXi5PNg=; b=PVZsC83bjd+01TPsTHHmjGlRCTWxaRCDN2smqT+/n7iRGLvMDgj10KEH9+eVbpFr545zXdLkmczBxnNGz7XzyyDQZVe0NENJgshYodH8FkcYLKHy3zIx/81kExvj8Z/ItX2E4V9PP6yBlRblYjmqWwcFCeyI1qg1LjhCBrb9g6qz/j+U0odlntNkLpBynCsJ+oVRJxuacfCjb9vv1Up7IMjo8C17nSJlyrCDM7sXxPwQeOrqap2EGRCRCwOqG1MPCwfuyA5BrwJQ3CfaXiSSHW9gIIBd/322V4+nbP7u6j9PDm0gLTm5WDwZ1n2jNBcrensvS2jFAattb8fQe6yL4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+nMuCIpAJRtDlH8ppEP94Lim1Y6yTT6BP9CsFXi5PNg=; b=J0yGQf/MUgOKhsiWAkUUMKIYLlnZhTotjtm7dEK4cH7ErK9g6z+CZMR8U93Of2Ax01hTO9CUrcZ/Ni4J6AuxzKANp2GHqtxV2CdbcDo8XhwcrRpe6NZkga6rKPVMJUe3QDBzCReKxtWxSBH2XVflxfDoyXeZfaIBMFUbs152n8s= Received: from BL1PR13CA0002.namprd13.prod.outlook.com (2603:10b6:208:256::7) by SJ1PR12MB6169.namprd12.prod.outlook.com (2603:10b6:a03:45c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.12; Tue, 28 Jul 2026 17:08:07 +0000 Received: from BN1PEPF00004684.namprd03.prod.outlook.com (2603:10b6:208:256:cafe::23) by BL1PR13CA0002.outlook.office365.com (2603:10b6:208:256::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.12 via Frontend Transport; Tue, 28 Jul 2026 17:08:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN1PEPF00004684.mail.protection.outlook.com (10.167.243.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.5 via Frontend Transport; Tue, 28 Jul 2026 17:08:06 +0000 Received: from rocgdb-taktemur.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Tue, 28 Jul 2026 12:08:06 -0500 From: Tankut Baris Aktemur To: Subject: [PATCH 2/2] gdb, dwarf: update complaint logic in read_tag_pointer_type Date: Tue, 28 Jul 2026 17:07:46 +0000 Message-ID: <20260728170746.1037942-2-tankutbaris.aktemur@amd.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260728170746.1037942-1-tankutbaris.aktemur@amd.com> References: <20260728170746.1037942-1-tankutbaris.aktemur@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004684:EE_|SJ1PR12MB6169:EE_ X-MS-Office365-Filtering-Correlation-Id: 25150be0-9dac-4de2-62fc-08deeccacb19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700016|1800799024|23010399003|6133799003|18002099003|22082099003|56012099006|10067099003|11063799006; X-Microsoft-Antispam-Message-Info: G9/gERXv5MekBnj1mXsnIg4sClPmhlG82M5F4Hw5Lug/FXoP4iVzQpDWOx1ba9lLv9ln2wB1B8cfBBVUWnIBg6UzlvM+jIKiqa0fMq9uyr3pvQMH2bpEikDKdDJfnFDSWY7jYenjOnhxSkTdu5zQf1tZr7yqeOl3mAQ7Wy6o0+QMM/1eKsz26q/MTKiOscA2cE8ZWY/+qIIO4KDAYN/KDS5oYJxx6c0ATiNhYPxZmULWqKI/olbLudwTREKoKaE2PT4oEmf8qF5XDDOxCrsF4yOiPz+ifyzRK5aEKMx1n0mVFs68fPyy+whqjObdLnGm1aL5hJWVU0hUm2lYvjWesO1Fm/yTi9l3+ehzQhABvXsG1NRISj36Q5l+w6InIGwGgtIuWrdOxcmpiFmKqTZ1EjUaPN87zfGP8B659F2eRCeHb19PTaymU51dtMzN/ygg1pwr/ZvkR+dD5Vh7+WDoaWBFR1X3UI5pE3Pp8n5AGOnpGWTImKqWf+BWpO29l2Uk+4t7NooxT6KYNpM2vJvprEf1Z6ZRfL08196lUr+OBzj6DKBnBA1FNdJp5eRtJohfuzr/0pksYnhGAGL/fQUMLhK+5KMnTdfnJ4v1M88MzVHOD9lWHAeTafJkjxPzWE5f/dqnkw2dX2QYLIHk4qOo/4lTw0GqWFtgmsjWhbhk6ePkAEG/vs2ef3GmwBT8ktBws07myrRhCk5KCwQY4qdGcQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700016)(1800799024)(23010399003)(6133799003)(18002099003)(22082099003)(56012099006)(10067099003)(11063799006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zyySdsinQ5Eiba98A9vxZp0q9Ei18XFqZhPZng1V2nPJJ244LWuiHovWqqb+tiYmPXucKcpHlbQEyOuXsqnzWPeT88ftAXtmvxFIvZrRJFn2nup9ZQx5NPmNkSERKIAdF4zRLmmfiLBDpI5PDVvaD/4pV01EeXfiHkcK5I79qCJo+nZO0754tUjDv0hXRLJ7BWbVFPfhPxb2MsfD2kIASLSxlSkHzgF5gYIyF1zyfAnDtsCNnf07+bv5Wc3tDoefl7rpjB1pUhTqKRJzVMZqpnomhYH7fbBB3P6UlYTfYkGqESPKRVV6YuEwkQC8mY7RiZ5aguFsWgu1UguecBBBZzKaep6XJdgvafsbl5IvQ1+eKWop6oUJwC76jHv0t530C7JZvP9xzQIPbIQ1S2RzfNcGBnzcyYqeTr2MlmT9RgeM8UmpKEqY1QXbanv3bcEN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2026 17:08:06.7768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25150be0-9dac-4de2-62fc-08deeccacb19 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004684.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6169 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org There is nested branching in `read_tag_pointer_type` with non-trivial conditions. I think what is meant there is if there is a non-default address class attribute for the type, alignment and size changes are acceptable. Otherwise we should check for unexpected size and alignment, and complain about them. This patch updates the logic. In particular: - If addr_class is default, byte_size does not match the expectation, and the architecture defines the address_class_dwarf_to_id hook method, code before the patch does not complain about pointer size whereas the new code complains. - If addr_class is non-default, byte_size does not match the expectation, and the architecture does not define the address_class_dwarf_to_id hook method, code before the patch complains about pointer size whereas the code after does not complain. (Similar cases for alignment mismatch instead of type size, too.) I think the new behavior is what was intended and it yields simpler code. --- gdb/dwarf2/read.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7db76140319..ca475f53745 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12043,10 +12043,7 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) /* If the pointer size, alignment, or address class is different than the default, create a type variant marked as such and set the length accordingly. */ - if (type->length () != byte_size - || (alignment != 0 && TYPE_RAW_ALIGN (type) != 0 - && alignment != TYPE_RAW_ALIGN (type)) - || addr_class != DW_ADDR_none) + if (addr_class != DW_ADDR_none) { if (gdbarch_address_class_dwarf_to_id_p (gdbarch)) { @@ -12055,22 +12052,19 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) addr_class); type = make_type_with_address_class (type, aclass); } - else if (type->length () != byte_size) - { - complaint (_("invalid pointer size %s"), pulongest (byte_size)); - } - else if (TYPE_RAW_ALIGN (type) != alignment) - { - complaint (_("Invalid DW_AT_alignment" - " - DIE at %s [in module %s]"), - sect_offset_str (die->sect_off), - objfile_name (cu->per_objfile->objfile)); - } else { /* Should we also complain about unhandled address classes? */ } } + else if (type->length () != byte_size) + complaint (_("invalid pointer size %s"), pulongest (byte_size)); + else if (alignment != 0 && TYPE_RAW_ALIGN (type) != 0 + && TYPE_RAW_ALIGN (type) != alignment) + complaint (_("Invalid DW_AT_alignment" + " - DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), + objfile_name (cu->per_objfile->objfile)); type->set_length (byte_size); set_type_align (type, alignment);