From patchwork Fri May 13 08:07:36 2022 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: 1630563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=eQ9Q1OKu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L01d61cBGz9sG0 for ; Fri, 13 May 2022 18:14:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BF6A3858C2D for ; Fri, 13 May 2022 08:13:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BF6A3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652429638; bh=hOVEv8Uf1jkL4B7p15HeYO7IXOu2pZf3vwjlONcIlWM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eQ9Q1OKu5hCC1Fb2gmRneAnQZ3FtinTHXRMiH3h8cRm30Da3QGPU24PfIjyf8p7ad RaQQltTMJSSHacnW+7/1goSPChbaeM58QVVJVhx+kaF6Qk/iTcsG4P0acoMy+OD/QE jAJNtYt+lN3M8v+Bdnnyc2W+pv9lwfT0nlymHlCE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 8C4B9385043C for ; Fri, 13 May 2022 08:07:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8C4B9385043C Received: by mail-wr1-x42f.google.com with SMTP id v12so10304476wrv.10 for ; Fri, 13 May 2022 01:07:38 -0700 (PDT) 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=hOVEv8Uf1jkL4B7p15HeYO7IXOu2pZf3vwjlONcIlWM=; b=yiFOmAioRp2+4M6W5FujwAqnlMS4NR1RKgtXDVU+4LhqcH+NzAZ96PohtcW6XNaFLh xvgNeR0sw9A9bYdlCsiJlVQoWnk7JrXoLhKs1F2NQQ4K04itMK74sZNGmLzdaltu7Wc1 oeUVPA+e5l2TqudYvYSJZ13meJppXrWGW9edwsq8I58i2O7um4yJgMEaTfDDG3w7/kR2 KIVcZjyfQw0nXgWPB5ozRUNVxpc1Fa3i7VSPAs2GG3osGGR0bMY6Qf+LCA63GXH4G/1q nqvK+aOOoJGVBHZcvISJGPUfT9YxLNjV0SEBHBZqlzt07cZ8Le9uFCWBWfL4mXVe4eKO YsVg== X-Gm-Message-State: AOAM531cZ/JUvA0gQr42sT5RTev8hTy7vhwIC5mIyeheALlzAgsjuXhy ar/FUQLKATBShCMPSyqWPU+lJLeP7sNjsA== X-Google-Smtp-Source: ABdhPJwenwTquNol8s3HmFQtmZWrvWZNz0MJmUyfsgpeiW0DijAD9ilRGRosT6bc9Iyg66WIcrnNYA== X-Received: by 2002:a5d:66ca:0:b0:20c:6970:fb33 with SMTP id k10-20020a5d66ca000000b0020c6970fb33mr2943576wrw.100.1652429257363; Fri, 13 May 2022 01:07:37 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id q20-20020a1ce914000000b003942a244f3dsm4672896wmc.22.2022.05.13.01.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 01:07:36 -0700 (PDT) Date: Fri, 13 May 2022 08:07:36 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix compiler crash on FOR iteration scheme over container Message-ID: <20220513080736.GA2465495@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The front-end drops a freeze node on the floor because it puts the node into the Condition_Actions of an N_Iteration_Scheme of a FOR loop. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_util.adb (Insert_Actions) : Check that it is a WHILE iteration scheme before using Condition_Actions. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7545,7 +7545,7 @@ package body Exp_Util is when N_Elsif_Part | N_Iteration_Scheme => - if N = Condition (P) then + if Present (Condition (P)) and then N = Condition (P) then if Present (Condition_Actions (P)) then Insert_List_After_And_Analyze (Last (Condition_Actions (P)), Ins_Actions);