From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kRjeLX2ncGqarQIAWB0awg (envelope-from ) for ; Mon, 03 Aug 2026 10:36:45 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=gSkGZHRf; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B895B1E09E; Mon, 03 Aug 2026 10:36:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 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 93F201E09B for ; Mon, 03 Aug 2026 10:36:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1EB164BA2E05 for ; Mon, 3 Aug 2026 14:36:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EB164BA2E05 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=gSkGZHRf Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010008.outbound.protection.outlook.com [40.93.198.8]) by sourceware.org (Postfix) with ESMTPS id A5A114BA9019 for ; Mon, 3 Aug 2026 14:36:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5A114BA9019 Authentication-Results: sourceware.org; dmarc=fail (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 A5A114BA9019 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.93.198.8 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785767769; cv=pass; b=Bl/rZoe3TcThJx2nDL8o8YvU/cgcHH3vWt9+GaEHc5MucdKbm+ZGdodBWwQ9cm0EiS6E7oHXxtbg/y09fE3JlJ1w3N5VF0YT8EccQtI/xxGHWNMIFUtSK+/6MT/sxL80gT4G1fkk5C/IgHeTe5aNUGKZ+egWWCmhAHibpEY0H80= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785767769; c=relaxed/simple; bh=DMVAmsb3xg2gwyg/jWFdJTYFydSo57bL/XSghkSR9aU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LsEev8oMoG5F4GGFwXQdvrHRo1vjjiX8sgHeA6yz5QQGy4Sjpwb4ARLRkSxc1EbcXf3WPCrAetaNYkzQiRKpT+huEVMo7/NHBlgTyOXpeOzm4V9BLR62+9WvTjBCdXqv2JhQxqEZo6WhFzL5oDgQZvt+9CiJvvHnrgvZ8xIn8MM= ARC-Authentication-Results: i=2; sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uFioMegfclAcMG5csKVBeQvsVLs6FFg/7YD0qVTZ3vdwtOUXFc4wOKlQ+PSmjSZCI3rK6JGCRSbP21Vmo9h1UpPHG6BnnLNvieX8CtzbP6QHq1Q58WNHYG5M0LIFnDIPucQGCD1a4BUZbV6rWpG4nKVR+IA5PfW01c53HWcslJzp0POQh5MD/KY3XXNjUZ3twVHQmC3uW3goF7d8XjnN4QN0V+JE0QNtETfcCFHqoYrd6nmMoz2d5ppAFCv59bhx+mWDx3dx7nb+fHdjrgVaFMFfGgDlQJejAZChEYQ41jMcnqTjZUcr4bBP/IUWOS/CJzRkRjkluFwMe0n6xXXC6Q== 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=tICUSvY/taOtv9AJGBqk6/80Js3wrP/g6wk5xhpAaA4=; b=dNaDNcY18lhZwLri3Ml5pyI8M/cLnnnLr78JIIT1fs7HumRlAze46dtR4JcVlER6+cY0jiDqsWpN5nPvjZ0WLfQVpi+kK/NqfLGYwhmlfPNLMgsDQUZzTucuRJWgWtIg+IzVSzL3R5dCW4/DP0cGZHp4/6Lwppg66dNaDICc2k/k1YLwPXvMo5WYvKdBBDe2rK1xlAsNt2cUrQtVzaoxEDEOQzMgnzpHY7M/XtdUVwxWxoDnpdasynb+vDbJxku4+dFKU3TUmFu2yAfLddSJ2x8iHZ4wc0zsh1CaRYqmR0qVbd9urCFigM31tzEwBRQ0jalwuGMue1XjCwFFWIAfeg== 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=tICUSvY/taOtv9AJGBqk6/80Js3wrP/g6wk5xhpAaA4=; b=gSkGZHRfKOwvOHjhjnxp8BZ95sUnnXI8JeS52M6lO3i0yVb58N9fCqp+cYqnPPJVbFxWggh/Q6AyLCYIi4ZF9FIUDTozO3m4zFMVxJpJpeiX/yUT2nq93Bm21WWVcS0MUw00vcFDy1EUvQB118pjtx4k+gr62wIokpI/4aeXcDE= Received: from BL1P223CA0036.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:5b6::18) by DM6PR12MB4121.namprd12.prod.outlook.com (2603:10b6:5:220::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.18; Mon, 3 Aug 2026 14:35:58 +0000 Received: from BN2PEPF000055DB.namprd21.prod.outlook.com (2603:10b6:208:5b6:cafe::72) by BL1P223CA0036.outlook.office365.com (2603:10b6:208:5b6::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.18 via Frontend Transport; Mon, 3 Aug 2026 14:35:58 +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 BN2PEPF000055DB.mail.protection.outlook.com (10.167.245.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.315.0 via Frontend Transport; Mon, 3 Aug 2026 14:35:58 +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; Mon, 3 Aug 2026 09:35:57 -0500 From: Tankut Baris Aktemur To: Subject: [PATCH 1/2] gdb: remove dead code in make_pointer_type and make_reference_type Date: Mon, 3 Aug 2026 16:35:30 +0200 Message-ID: <20260803143531.2958552-1-tankutbaris.aktemur@amd.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DB:EE_|DM6PR12MB4121:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d0dfaf5-15db-44aa-248b-08def16c88e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|23010399003|376014|1800799024|82310400026|56012099006|11063799006|10067099003|18002099003; X-Microsoft-Antispam-Message-Info: sIR5hnQOrTul2qRHN+Hubch+oIxdTkfu7P7k8sLySGc6h/1rrsH3ridkIRggEymfzTcY2JBHoQuKhYa9Yll817TIIiGVf//RHFORPzXEbZMBd0kknZ2vSQKeytwC5UJESxj9f14ylGcgsCg37w0Dk0rxHuvXQSMnwy2NrGeZ8lCbX16KrFkHmNINEybZ080OiEC+i3+vLaaCdfMPz08UZb4FwICj5KHUPjZRNZMX8uYPDaxa+MNMWEvUgePXedTi64mr2F7Eh8YXQ06GxoEUH9e4JKZRcb/tRONpeoAntU9PrbY/KLzQMWmA1MNM+NxekWZ/lwlJW/zc+fM8QpjXysyfM8+hZGKtiUMvOYkJlYLuQbFM8jZuRE4srA6rjwl3k+Udwft1j/+a5AKTt/C+FpgDkFiemU7LjuN62Rta7WFGqcybFwYi8N144zaL8iVclayXHjFo04+Fd1uZZ1lbSPcLeXfeBgAwifQBrcTaAnfeT08n9Rgw2xKAK+XwuHXI/mj7y9uUXAC/12FArYyGsh8/QDUx6dpIwD4s2n7KWbjqhL8Bn3ki1+jBcH6qts1SLGuWiYFQMwiO+AZiN9aokbI3Bl+c+MlRKOB4uwfVEyi3reudEQagu/sgyffk+YZSFgXTcog9A/3EdPwPjZw7NGdzYC3FX4yWH+qqVFArqtavLqcth14CBpsZFKJa+2zY9ZIXHaVoSeNVvGKzrX5ilQ== 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)(36860700016)(23010399003)(376014)(1800799024)(82310400026)(56012099006)(11063799006)(10067099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cLsUJ4OqjGLbZK0YnqNcjcQXzcDYuh9giC0eNz121tCsywQhZskgKKVeTtt1p1PtKTFzoM06YATtIEI8i9h6rOYPapfJ8jAzvZS5HG5xN/2xFMGDBFarg5wzguUFUeadiS/nibiZyHoyPXENkTjbDsUvES7TZcgI/UwW1JI2SdLlBd5p3tUZhbLqP4Us+1T64iVZe6/sEoZK5TrXPD1PJzCYFzwNx2MvvX57hfzDDgGS8hkm0XPUt9zClG2ZaA3HYOkiqCbhVXB+0PLM6tGR3zzoDJK87EPnvXrkz62vitLMsDpnwHIc5RhcWPvgJtz0qQiyhtujJLymP74Q1dv9RLf0T1H6yyRw+LqUpl3KVrd0rQmg2ug9lGuVCQimE3mCOEIDua2FdDIG6iAGIifV2TGyzc3E2tnK4XOffUSG/1ecHQAGFVtA/TX/0PqUEqBd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2026 14:35:58.7990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d0dfaf5-15db-44aa-248b-08def16c88e1 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: BN2PEPF000055DB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4121 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 At the end of `make_pointer_type` and `make_reference_type`, GDB updates the length of every type in the chain. This is practically dead code, because if we reach this point, we must have allocated a new type. After a new allocation, the chain contains only the newly-created type itself. See in `type_allocator::new_type ()`: type->chain = type; /* Chain back to itself. */ That is, we always have `ntype == ntype->chain`. Therefore, the loop can never be entered. Remove it. In `make_reference_type`, we also remove `*reftype = ntype;`, because a few lines above the assignment was already made. This is repeated code. --- gdb/gdbtypes.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9098727959e..2dda175237c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -367,8 +367,6 @@ type * make_pointer_type (type *type) { struct type *ntype; /* New type */ - struct type *chain; - ntype = type->pointer_type; if (ntype) @@ -388,14 +386,6 @@ make_pointer_type (type *type) gdbarch_address_to_pointer. */ ntype->set_is_unsigned (true); - /* Update the length of all the other variants of this type. */ - chain = ntype->chain; - while (chain != ntype) - { - chain->set_length (ntype->length ()); - chain = chain->chain; - } - return ntype; } @@ -415,7 +405,6 @@ make_reference_type (type *type, type_code refcode) { struct type *ntype; /* New type */ struct type **reftype; - struct type *chain; gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF); @@ -439,16 +428,6 @@ make_reference_type (type *type, type_code refcode) ntype->set_length (gdbarch_ptr_bit (type->arch ()) / TARGET_CHAR_BIT); ntype->set_code (refcode); - *reftype = ntype; - - /* Update the length of all the other variants of this type. */ - chain = ntype->chain; - while (chain != ntype) - { - chain->set_length (ntype->length ()); - chain = chain->chain; - } - return ntype; } -- 2.53.0