From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Fix compiler crash on FOR iteration scheme over container Message-ID: <20220513080736.GA2465495@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="CE+1k2dSO48ffgeK" 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-List-Received-Date: Fri, 13 May 2022 08:07:39 -0000 --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --CE+1k2dSO48ffgeK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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); --CE+1k2dSO48ffgeK--