From patchwork Tue Nov 9 09:45:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 47246 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 7907C385800E for ; Tue, 9 Nov 2021 09:49:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7907C385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636451381; bh=2ud8mDL7YQhrIiXYpd0lcts6FE5bPRZIgd6NxXYssNM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=uONohauiK84wKuExwj0F2Hqbr2j7Kdz67TncT+z2apI1XOiJANsP/DGMOgFjV+1st XCpNZVQ1O3B3IUaPqLT+j5pR30ppXVhE0/kENBHpUxdJrV64W89KwnT/omJOXtp22b JNAMap/mEa7f9gss8aW0ez91aEyuf+pXgGjWX5i0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id 9A4153858425 for ; Tue, 9 Nov 2021 09:45:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9A4153858425 Received: by mail-lj1-x22d.google.com with SMTP id h11so35168694ljk.1 for ; Tue, 09 Nov 2021 01:45:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=2ud8mDL7YQhrIiXYpd0lcts6FE5bPRZIgd6NxXYssNM=; b=60IBXVz4guqyvRetAElTZxv45L9xNxdV65U0pk4R/l3Z9LdQuGXLk02uciNzZHoSsY PG/sCoZ+2EokrPOSTnMvoN5d840OoiNx8CgTEUdwUNBsZuEoouqCarehdn43yragdmEq +jun9YhkZqw/FnVcpa5oAfbrfP1lGiH1JEr7vra96kXXF/L0Eri8lEysef3Qu8UCeOxt UbXXusKwqSpypJ54/Q0LmST4lKqA9+dOHxKcX+kUZ1RTfdWz91SJMWOPWI0fXpLFKZ+p izOzw9C4CRrhI/SYsmS8eDjY3Rmdno4dU31ilWsfoEUsMXP8artwQM49p35S5dNLJ5LB qpLg== X-Gm-Message-State: AOAM533cJdSqHcqipO/sx8gF3LjXo2x0XepnzCHq2vnxUXSp1OFCBAw2 U9wZgYfxyQyxX9nWzD/JgQniJUG9N6sdDgAN X-Google-Smtp-Source: ABdhPJxJijX/I6PaoaTnV6Af2yseSH1mW97xE/ug4/gtwF8KroBVsM3x/leZaEO4icslXc7zmdFYhA== X-Received: by 2002:a2e:2f1c:: with SMTP id v28mr6002899ljv.355.1636451144447; Tue, 09 Nov 2021 01:45:44 -0800 (PST) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id bq39sm701124lfb.262.2021.11.09.01.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:45:43 -0800 (PST) Date: Tue, 9 Nov 2021 09:45:42 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix detection of array aggregates with single others associations Message-ID: <20211109094542.GA829999@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Detection of array aggregates of the form "(others => ...)" needs to be adapted to iterated_component_association, which was added by Ada 2022. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb (Apply_Constraint_Check): Guard against calling Choices when the first association in an array aggregate is a N_Iterated_Component_Association node. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -1388,6 +1388,8 @@ package body Checks is if Nkind (N) = N_Aggregate and then No (Expressions (N)) + and then Nkind (First (Component_Associations (N))) = + N_Component_Association and then Nkind (First (Choices (First (Component_Associations (N))))) = N_Others_Choice