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: 70227 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 47A263952527 for ; Mon, 29 May 2023 08:35:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47A263952527 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349359; 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=XpuUNgv3KXgjMwAKpuM4EIXcDhPmbrEShaczKRO3qaiEm2sfXcbnE5AdkHhRZiue+ JUxcvcTp5EZt6zuhqLaknispAQlaY5iBhGucgUYQcd3jsXBLNuLKaEfzZoQ9pB+EEN WhWyBEpHq9F4zFCqth8aXyBPJGz08BMuK92pltnM= 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-Google-Smtp-Source: ACHHUZ7ZuPouQyu2rCZHavSqZepmTCBaIx2ODZiD+C7Pzaudad4a8qjFBLDJNvsulsgEIy9GFND6wg== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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))