From patchwork Mon May 22 08:49:38 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: 97182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1300524vqo; Mon, 22 May 2023 01:54:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4R2vg6vj0T01LcjHkMUoCzMKpcgE7gf/sOCdRfMYxOGBz0Hp0ezmHkln3mIZtJnSdFW/CN X-Received: by 2002:a17:907:985:b0:96f:b40a:c85f with SMTP id bf5-20020a170907098500b0096fb40ac85fmr4279585ejc.23.1684745640225; Mon, 22 May 2023 01:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684745640; cv=none; d=google.com; s=arc-20160816; b=doYY4SSOdufU/4EWXhXkeczapSNoXjHLaKkZ3GF8Sc+AjsmuE+hbCqhxNy6ghpysII NdWuLnNZPCrLVtWFb9wMuP2lkJTJL9K1gxFePp9pqbysysETD/2CcXJCdnwrjYiJ1dig xZVMat62gOnTkVziprQPe6TtJaxRA1MCLiW7FbMWasZhxEPOntoOzVLXJsG8W/qt/duz wQoU/+f0cLlgLEGsKQ7ADGnend9vVm3c9mOojrocV4cVPRV+zZp1yLqgn3kEL3WsZu9r 9/3DpsVZyQkvsSd/EH/G8AkTdo7GKtsj5AWM9E+MuvFGfv5kvM30/Wa6LTz2z38cPZJj 563w== 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=DgFSkGHw5+r36QBXRrZyFNo45LOLAZnGcx0LjqXYdmM=; b=qUV3s0Ch8l4SOIAJScPrljFyAv4vLEXGr6p3bVnGiKSQj1/RPa5k0crn+KCDe2sMJ5 yp4YLzVhyS9QTbgdmPVwa9H/Ph9sRibEGVl9Hl8xCo5UY7LZBVZYtDe7whtGTCNv4g9B R7/RT1C7Pe9Ekv2w7mdjOeS4wmk5uzZIguWhpHmaoEbOycEXMjM7rX6DJet5qMzjGu0A emHpIFcKgepqk8rFNWGAft358Q4Kqx0VxUJefufPgwJTL1prLO2PkU+gCu4u1dK6s5TV 5nfC+HfWw5wXHbnootltKXcPI81VX2JataVUfD/UWyk+TD1cmShOkF6qzOOkD9h+6ir3 uULw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WN1OKK+z; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id su24-20020a17090703d800b0095ec56a5f14si626212ejb.370.2023.05.22.01.54.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:54:00 -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=WN1OKK+z; 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 81C20388A419 for ; Mon, 22 May 2023 08:51:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81C20388A419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684745490; bh=DgFSkGHw5+r36QBXRrZyFNo45LOLAZnGcx0LjqXYdmM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=WN1OKK+zsgElQkLhalONKU9O3FG7v+PXXSnJwRHF+KRPbBIAbadA99eqpsb2hbHuz eHeUWcamYq+8cTa8TPP4qqu3BN6WBVRpCIN1bxI1eqtWfZmTUDyyruB/ifvJCv0SzX VT8fv4T1oTwA1Lb9cYxWesIYDI8QO7K/4I3alwzY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 870223857711 for ; Mon, 22 May 2023 08:49:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 870223857711 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-30a8c4afa46so821380f8f.1 for ; Mon, 22 May 2023 01:49:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745380; x=1687337380; 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=DgFSkGHw5+r36QBXRrZyFNo45LOLAZnGcx0LjqXYdmM=; b=MiBMkMC3CJNNkeaL8qM3OzNaFE7AgemF6a0gefGlwbz+jGW8Tu5Jf98F5YOM0gLOCa KZ3mP4GdJZofCth79c1Nm9IK6iBQg/aJKF8bTkM4FyLg8tQCnbNpCtNDGAUZGLYmu3LK 8lyO8O/8BS53KY8gH/QhKwc8bTQ7Jmdunwzzg5ceIvVnIXbcS5w9L04HgqZ5tvMtSfKt l3MDPKgRprLPUqvJMj3/kmzgRDekrQkdME1qnKRv1Fut/EdnXnC+S64CQOrftMn2KRU9 lM6mCWGAgZ7WuM8Pui/79ZbMm6bE3q1KUGqaJ9AyaGwgKslvwcZbNbTqsw275NYtAbTc 4ljQ== X-Gm-Message-State: AC+VfDyKANbI1aW/fjdyoJ+Ca3IF3ZM0uCkcdscEcRtwxgy1YGrzsLPM u1PSY8ZqH7/FVAsMFaWkHjaTZzP1PcWd0Fy2R6crTA== X-Received: by 2002:adf:ea8e:0:b0:30a:907e:bd7 with SMTP id s14-20020adfea8e000000b0030a907e0bd7mr1338611wrm.29.1684745380359; Mon, 22 May 2023 01:49:40 -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 8-20020a05600c22c800b003f4289b18a7sm7646811wmg.5.2023.05.22.01.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:49:39 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix handling of constrained array declarations in declare-expression Date: Mon, 22 May 2023 10:49:38 +0200 Message-Id: <20230522084938.1725583-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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?1766583844462951716?= X-GMAIL-MSGID: =?utf-8?q?1766583844462951716?= From: Eric Botcazou They need to go through Constrain_Array or else they do not really work. gcc/ada/ * sem_ch3.adb (Find_Type_Of_Object): In a spec expression, also set the Scope of the type, and call Constrain_Array for array subtypes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 66013ca0134..7596a59edb9 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -18417,10 +18417,10 @@ package body Sem_Ch3 is Set_Etype (T, Base_T); Mutate_Ekind (T, Subtype_Kind (Ekind (Base_T))); Set_Parent (T, Obj_Def); + Set_Scope (T, Current_Scope); if Ekind (T) = E_Array_Subtype then - Set_First_Index (T, First_Index (Base_T)); - Set_Is_Constrained (T); + Constrain_Array (T, Obj_Def, Related_Nod, T, 'P'); elsif Ekind (T) = E_Record_Subtype then Set_First_Entity (T, First_Entity (Base_T));