From patchwork Tue Nov 7 09:19:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 162331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111734vqo; Tue, 7 Nov 2023 01:21:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6JxYneBwQEYk3Wjdn8Aaik+wN6yPIscNxByW9GYNR83EgVQSIhz1vL2HBY/mHqDy44zcj X-Received: by 2002:a67:ae49:0:b0:45d:b475:c60f with SMTP id u9-20020a67ae49000000b0045db475c60fmr4710970vsh.5.1699348881299; Tue, 07 Nov 2023 01:21:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348881; cv=pass; d=google.com; s=arc-20160816; b=tx5nDtylH+ERPsuceKMctrva1ef0XSIgFcB7ja4uw1nXcG6AhDZftFCQr6lkueD/Ui xiRfX+/muBkWWjAJbme/JTV8g6KQIU5vGplCPxoxvezQMEo/jesCKTPMT74nHtswhK2F W1C7uMcTmi8cwrbm566QiPPXmTRDAu6MwI9iZ7ElF/1gwt7eV7Z7ea+rxrhTEukWSwBJ S+EP6uc9SZDMST/2JtTMJlXKfKBgbveFoBo3OsddNQRfD61E1mh6vs6bwazKsefStqu+ NPcf4+2D/+4qeMfdXf5ub87+o1wkaJesJmbCXTC7J0WW3GTmUvrg9HV2VQrP9m9+XpEH aA6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=o8/sHFCBfnnYqTObgDX/umg95gZfMIAHHPjCwhVx6QE=; fh=QRb7QY4BZ0mIIAPiH2G4K0PcYKRtRn2i5A6VLUA8cN4=; b=IgvE5WDxAAnr4m2QnJewCRVNgKwBOm/O+9S5XIJRHB7itF0egmGEYI9XRzfQL0h98h xjjmCATRUEXCkKmoT6aHtioQ4W+yEBU0ss9x/e8Gn9nftB/t3Cg/m6sU7MOhP1zkBi3C AJDF7Zdqtxqy5a3bHG5e2eUtvEEbAtfK2NA9eK6DogX8VePdCjuzPtNjnphNmOQ8U8sx xAclPvpS3+KHAUcsBEEcZL2G569fexdwuPrfkj/jQDzImAYNN4X5Owhuz3gIggzPZF3c lhRHGv8ayrjUUH3VE6BmvcKp/uuqvHr35hA4QToTK7COSFrFAizduj00Dxvxl18ysGJN XyEg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=SreNl98W; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o17-20020a05622a139100b0041962d20ecasi7014383qtk.90.2023.11.07.01.21.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:21:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=SreNl98W; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE55938618B7 for ; Tue, 7 Nov 2023 09:20:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 80D823856969 for ; Tue, 7 Nov 2023 09:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80D823856969 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 80D823856969 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348780; cv=none; b=QhgBeBo3vr+sAjjJo49Fm9aelYxu6vmZA2SklEiZlKhfQLi1CnNr/8DcWlDq5nb5en3ALNEd4ScPqoZ4edcJ+PIkIr5mhexqNG7sdrWNwjX9qPIogfnfPbM2dMwXzP8eSkfl41Q/jCQBMF/8zUIjSeJJt+3J8jOagBBxqCe7zOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348780; c=relaxed/simple; bh=2TAFdzIMEDEnZpiwc9LkYbxU3YGpqrUL+TXBBVxxhkc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ngQ91F5kUw4cJCCfU3XSTV9JpsB81qMYDbxo1CF+dqJyIujR17RVZeEt3VgYVNnX3J4ulLP+vGG1J0EJf+c/36+aNtKjpoBlZVWhTCZKE+4LBRemqkEa3b8X1pSGxzqNbRXUoooUJxHFdUKS/vKvfjWzTzabVHLc7DXNrBXs+10= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4081ccf69dcso37928495e9.0 for ; Tue, 07 Nov 2023 01:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348777; x=1699953577; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=o8/sHFCBfnnYqTObgDX/umg95gZfMIAHHPjCwhVx6QE=; b=SreNl98WjyOcwI87jwcdyf8fBP1IyJSEpBjfvkeN6BiHJg9lk4r49VaOYgnOP/G4yL JONtk77y18B/TNJjnWWDPF2csF34npxF1Nk2lTdfuiQWJ+rA2ICcbVHkHPmSrvJ5uIHM zpJx4bABZveOOJa4zgwM4uE8JvW9KeEc/qHo9h+yF+5YTdJAaSNv6TIlEzq3nADLfGNF OQ3bVeD2tCY276hWj+TZGFxLrBndi7o51U/9SfphAmpAyKuhQaQejG455QzH63T/TlN2 11qUwGfSwZIPkriikdxW5T7P8QmVJbqLer4zDc+sgQ5TmxGnAV380mkoYm1HlF7JQ+sK lucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348777; x=1699953577; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o8/sHFCBfnnYqTObgDX/umg95gZfMIAHHPjCwhVx6QE=; b=Jwd209KSla3P6yqEXi0KP/7YMu//VYRa0HcPLlaHLn32fLDK5+M3UAHcxOrSkFbyoC +JSHf4TAMpKIFkGX5wSvOzVhMnwksQgArQZ4gNRImsWBPShGWTGS4NYqUa/lTLLkMr/q qXjP6HdSu+pgDr1c7WQd0vCsOXebwyhwa4KWxdt7VpzGSvXoZDsBtQKkoqxqwEXfk5qs qvSCl+isj2AL+RAYGluhC0cmu5NaQdpDnfd+26KfYnzC6NLT3NUOJ1uk3N16kmgxdut7 ASjJsUUdH879Bj1fomfuXIkzqId68Z7NbRlBeAwRi0jKcUn7sbu1noM4QcTOrQjHRhUa rC1Q== X-Gm-Message-State: AOJu0YzQ7DO/NUZzXmKV/gnr5Pa0su+qjQf2RVYbbIlIcWxqx2isultR NfbOEBE6tu/fcXPz7drllzjuM7atsYRS0rUDffyP+Q== X-Received: by 2002:a05:600c:4453:b0:401:b92f:eec5 with SMTP id v19-20020a05600c445300b00401b92feec5mr2139002wmn.9.1699348777029; Tue, 07 Nov 2023 01:19:37 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id fl17-20020a05600c0b9100b004097881d5f0sm12257711wmb.29.2023.11.07.01.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:36 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Change local variables to constants in expansion of packed arrays Date: Tue, 7 Nov 2023 10:19:32 +0100 Message-ID: <20231107091932.3905575-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896452423055017 X-GMAIL-MSGID: 1781896452423055017 From: Piotr Trojanek Cleanup; semantics is unaffected. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Change local Decl object from variable to constant. (Setup_Inline_Packed_Array_Reference): Likewise for Csiz. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_pakd.adb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index 2d3abbd349d..1641e8a51c2 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -1137,14 +1137,12 @@ package body Exp_Pakd is if Nkind (Rhs) = N_String_Literal then declare - Decl : Node_Id; - begin - Decl := + Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'T', Rhs), Object_Definition => New_Occurrence_Of (Ctyp, Loc), Expression => New_Copy_Tree (Rhs)); - + begin Insert_Actions (N, New_List (Decl)); Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc); end; @@ -2481,12 +2479,10 @@ package body Exp_Pakd is Loc : constant Source_Ptr := Sloc (N); PAT : Entity_Id; Otyp : Entity_Id; - Csiz : Uint; + Csiz : constant Uint := Component_Size (Atyp); Osiz : Uint; begin - Csiz := Component_Size (Atyp); - Convert_To_PAT_Type (Obj); PAT := Etype (Obj);