From patchwork Mon May 29 08:29:16 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: 100160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365205vqr; Mon, 29 May 2023 01:42:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5O8VsXvYm5hVo1rtXQm3Nh1wqSw4t5mTDLAexn1CE8S78pwYXqfOBzLDz3GBsWNdgXtCMH X-Received: by 2002:a17:907:9622:b0:973:91f7:5092 with SMTP id gb34-20020a170907962200b0097391f75092mr13318103ejc.2.1685349745189; Mon, 29 May 2023 01:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685349745; cv=none; d=google.com; s=arc-20160816; b=Vfvum2jmWcO9tzYvAJzB60PIuXBBLxPQrz8nzvEW+hrZjLfjt7+p4Ov+E5Gm4kyN7B 5JzkxvO4obo+s8tSLYOiz0U/NJlHuu2YKxzWSIt8A0221gHVL5Bcw062ktqJc1Ftpla2 tDT6WrqtX8/A4FasoILPck1pqaiAbTKOI0KiQN8DpVP6xcd53PpJAXe60dCY9DGUY93A /uWgTNP+Ag7WPmjOgsguJbkx34clT20T+13DrMlikrccddIeOxVZ1CibedfaIT+Eww+p Ea+PeGLufRBquFmeHgeI/exwUrE23BIK7OsyOxZLfw/6YbduZZ3YsX1H6Tvnc3MktiC0 IkGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=xBTXHn4Dj+MyxB+/Ne5QbNdrMgdV0Rjp43TYESrSkBg=; b=MNK890tG4laEHN5UUe8gjq6gK7QLlBiF+SdFCl+QmNNmxu4spfR85AHg2CR3WXzzm9 qk05wAa4tcPddUSoPNK5kL2j6zg9jrxDE+qJ43YpWh8nynko6rgzBve45HXt3InXtbwc m3zlWN9u2zRY3b44D/w4QROMhNg4CyK9djvladPht57uOudZAqy1LdbA99J3Vgfbkydz xRfbn/R1kanJ/JPBKU3TkdglndpJjLxqS1wnMCCfrBD8BeLdPlQ6GNUKtAExtwHTzlnS Ne4RDXETbCSa5PzB95SlfUzFALBW2QAg2UB8qqpWuAbxj9Yy5MaEpUE/rAz54/GynuiS YTIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=jHv6ZkeY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ho18-20020a1709070e9200b0096552e0fce6si5921930ejc.360.2023.05.29.01.42.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=jHv6ZkeY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D46E3954438 for ; Mon, 29 May 2023 08:36:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D46E3954438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349378; bh=xBTXHn4Dj+MyxB+/Ne5QbNdrMgdV0Rjp43TYESrSkBg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=jHv6ZkeYj7rcFSj1t5oxRow9/E24CDlob0x7whLAWLD27K3jU5LX1E8J/IN9JUiTG zoJhjHiGZ4Ti7uRD72G7ubOPIDRPYWAyW4W1LSoy0MNRAiIskwN6rb55Lus3JXtHtk EvmsTSdi8N1rqDk9l9OQmVFgI1+JkuH9Q9oiyA/8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id A73D1385559B for ; Mon, 29 May 2023 08:29:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A73D1385559B Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30ae967ef74so503881f8f.0 for ; Mon, 29 May 2023 01:29:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348957; x=1687940957; 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=xBTXHn4Dj+MyxB+/Ne5QbNdrMgdV0Rjp43TYESrSkBg=; b=MM2e0Y61jxeP+Nt4XzwDV0VVsPgUraU8AjwUUcA9gLSqONgL78RpeM05bgfCGe/nLL LMd9Bczgvys8DmhwEtif27ZAKXB+238JCJaErcwzSW0sd9nBHnxFPjrraTJ6A8Lwrl1T 8OQAN0WWC6z7pZq3hYCF2WRme4o6UhDP0bB4shOkVAzC7qwB/MyEjamDj7I9kvfkkebv tPKAPzUU6O1R2m6K/BwJXoQpKFMD7TYbu2WWh1WmshPV3W5ZDkKfPeNdjSniS4p7UGMQ f98vgsKbTfzGAe3WptL6ybZHluZcPaxIj4ZUVDrGXTf5+OwWPISpzV0qT0elXdd/DRLY /Vlw== X-Gm-Message-State: AC+VfDyKhFfRf0D0VXIBJpbnnKrS79rjFv919+mSyYMZzulJY+GNY+iI UtpMjGn17Pc9EdJ+15wvs5vZppcqBocowfo9y4cTUw== X-Received: by 2002:adf:dc89:0:b0:307:bd64:f5a4 with SMTP id r9-20020adfdc89000000b00307bd64f5a4mr9561696wrj.52.1685348957475; Mon, 29 May 2023 01:29:17 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id l13-20020a5d560d000000b0030aea925fbesm2661727wrv.50.2023.05.29.01.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:16 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED] ada: Default_Component_Value trumps Initialize/Normalize_Scalars Date: Mon, 29 May 2023 10:29:16 +0200 Message-Id: <20230529082916.2409887-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767217294867371966?= X-GMAIL-MSGID: =?utf-8?q?1767217294867371966?= From: Steve Baird If the Default_Component_Value aspect is specified for an array type, then specifying Initialize_Scalars or Normalize_Scalars should have no effect on the default initialization of an object of the array type. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration.Default_Initialize_Object): Add test for specified Default_Component_Value aspect when deciding whether either Initialize_Scalars or Normalize_Scalars impacts default initialization of an array object. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e23a3fde15c..5f651bacafb 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6897,6 +6897,12 @@ package body Exp_Ch3 is and then not Has_Predicates (Component_Type (Typ)) + -- Array default component value takes precedence over + -- Init_Or_Norm_Scalars. + + and then No (Find_Aspect (Typ, + Aspect_Default_Component_Value)) + -- The component type must have a single initialization value and then Simple_Initialization_OK (Component_Type (Typ))