From patchwork Mon Sep 12 08:19:24 2022 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: 1141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1780316wrt; Mon, 12 Sep 2022 01:25:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR7JdbJlPurTGBUI4plRD6F2WnsbjH6lm+nfjreYgSH2HQE/9Z7nY5AOc4EwpOr01v3J7wtS X-Received: by 2002:a05:6402:22c7:b0:451:403e:68f5 with SMTP id dm7-20020a05640222c700b00451403e68f5mr8807709edb.242.1662971142835; Mon, 12 Sep 2022 01:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971142; cv=none; d=google.com; s=arc-20160816; b=ukaBhLCifTKcW+oYklnL9eei57EpM0ixo1hQ901aXARoKAQgo4ZlpzXtK/Q0BBTINv SnaGTo3o6IkbubPBycT9z54Qs0DgrAMomzt7YwLlwEI5pDhIZ5TubKGd+XEvkvj1NCmQ DO12lxoBLfp9zkt+QKI96DCtm5v0ardKRFhq7JPX/JsHR1GO+f8l/xRvoGG8p9TA0lpe h04TwL1J6uuk2i3kv+cs6pOkG4qb88a+RENRKdvsXBkdPF/KQl50aAH5dmJiaM87yh92 EPpKipy2SXUbT3OBGtEaBjBxb8XhexFP5RqnvBymtWpalmSFounfWb3XkcLu4p6q8+Rd ayRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=EnYN6VKGvHEucoW+UwaWiSGZUOngk8RmJK3hWFVbMaA=; b=LFwrcODoDgwCfNDgbA3UAGSgL1MtvBgpOMVup5NDHfUTwJY+hellHT3Rd4RAJlbgpU Xyu3TmYMh4uru6LKzD+wmv/ad7N4px+kYTq2H5+Tw6FzZMxUX6TVAvRApG4LSATlhPHA CmaFljvnXDEZUgTc2FO7byTWPK6oMfGapq6S7BRmQCPiXZWJoY97KmmTAKpRSo24CNjn r3j8HOP0NMByzOTXl8qv/Puv/pJIfvohbxDI1N4NaQ/iZ+Hk1XmB0uzJQVyo1EFgr0MR V4whkuETcvg2YUr/b0b7rfOnN3PDfyl2jFO22l7zNwbl0UGyn6lwqGOEa88nQ6n3XhTO xNog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SmF7bzKN; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l6-20020a056402124600b004477cac2be2si6827481edw.242.2022.09.12.01.25.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:25:42 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=SmF7bzKN; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36B443895FDE for ; Mon, 12 Sep 2022 08:22:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36B443895FDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662970936; bh=EnYN6VKGvHEucoW+UwaWiSGZUOngk8RmJK3hWFVbMaA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SmF7bzKNLEgGyK6AjsMjW6w6amF6wpfSLjkyy8YUYr8z2i8U3zMinrg/0inV34W+D 3uIlL8HdjA0lGHbNHvoNI8Xh67JSEEtQ+3DJou1e0TzKDbnAuPo5FoThckQAvGNBmq Pe68f+ntl38bN01Y1mDUh03sTXlJIxlpmYwkDV3M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 9D2D138515C5 for ; Mon, 12 Sep 2022 08:19:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D2D138515C5 Received: by mail-wr1-x429.google.com with SMTP id cc5so4235772wrb.6 for ; Mon, 12 Sep 2022 01:19:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=EnYN6VKGvHEucoW+UwaWiSGZUOngk8RmJK3hWFVbMaA=; b=oyY2JRnWKTLNlYrbyy/blJtqGLViM+mMFzfnv+oss0TGWBSb9TYRm8nNUp3QOujUDu af/GiPUn51X085mjDZ870kI+Sxx/9msrC8a7UMElTnCrPeW9qm9H0s9ffgu0lOyIkdel UjVPI9UuKdNRmTsX2KjxDggB60RAvn1s6O8LbmrzdF81HONCav+BrPuhYwwyfnQYukSX C1JjvL3nFr53rceZFAapxjQA37zHOskGMD7oZ98p5bBQXRjZJ+sAvAxuFHlQObKjWiNo XU8UJD+vvhJ6M67ZQkV9Yv4qDQLF0ghk3gcnVSt1HWwjFxaCGLrgUZ5Ad1wiiWhZbZYH XSrA== X-Gm-Message-State: ACgBeo2T3WReVzdfQIqIrUrIO3B09Z7jsKruO9pA9yt0ZALzAb27pD3q B2Ff2m95C1MEQHgNtaRVN3wxl0CDvYWa5w== X-Received: by 2002:a5d:6f19:0:b0:228:d8e8:3ac8 with SMTP id ay25-20020a5d6f19000000b00228d8e83ac8mr13669117wrb.101.1662970765258; Mon, 12 Sep 2022 01:19:25 -0700 (PDT) Received: from poulhies-Precision-5550 (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id q3-20020a05600000c300b00228d6edade0sm6607028wrx.46.2022.09.12.01.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:24 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:24 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Syntax error in Ada 2022 array aggregate causes bug box Message-ID: <20220912081924.GA1512905@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.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: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Steve Baird 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?1743751629002220988?= X-GMAIL-MSGID: =?utf-8?q?1743751629002220988?= Check for the case where a user writes "in" instead of "of" in an aggregate like "[for E in Some_Array when Some_Filter (E) => E]". Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Generate an appropriate error message in the case where an error in the source code leads to an N_Iterated_Element_Association node in a bad context. diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1987,6 +1987,11 @@ package body Sem_Aggr is while Present (Assoc) loop if Nkind (Assoc) = N_Iterated_Component_Association then Resolve_Iterated_Component_Association (Assoc, Index_Typ); + + elsif Nkind (Assoc) /= N_Component_Association then + Error_Msg_N + ("invalid component association for aggregate", Assoc); + return Failure; end if; Choice := First (Choice_List (Assoc));