From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 7FEBA386F001 for ; Tue, 19 Dec 2023 14:30:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FEBA386F001 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7FEBA386F001 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702996237; cv=none; b=YgmsYJQiN5DqtWQmzKVFkkFu/d8PEc93lmO9vJQ9u4KX+sY1XtTsQ3RijIeZzNv9hFwsNdzWi0ZpbVBSLvlwGkPRYTbOIO2bmQyRNRi/M8I7mJwMD/+6oa14wspfRrov+64T/xLRSLbhBM56zdC47fl9buPaI5I5aBoXcO9idtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702996237; c=relaxed/simple; bh=FCBovFaOLf/ntIjdJ49gTYYIzUhXGipXEd+5QrRz+Kw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SkW5b1WLIOTop32SZ6ZR4DPL+ZOUGwszxcw5PpcQ8IMbgw4r3mNSzw2EuTtp3LJ0+mN0nCKcvVjlbobAf207zVjj2qSD4EJfmxF9uWAfSJMEWnzvXr/olEIkgVOAkKoqB3yMNBmuJpihZJrM7QDG/ODXKqUfRfOF8aEnt66SuiQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-336437ae847so4899674f8f.2 for ; Tue, 19 Dec 2023 06:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702996235; x=1703601035; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hrrYVhE07Wh7eZ2uUcxS1QGWEszq2wcLdVswcShO1vQ=; b=LOoCFhkbGjuXgiyRX/lcjX+G+O3rmPYHB+sKGKTrjZwRyU9IN7lcaoqpBhdA5nDBVQ cOPrfy3DTSl4MLb2FBC9ftIJOEDFCns0e3U1fykjMo+LZR2bFNSANN+mu77yNupo2iHA L30AczygxZNSTuRlCzXvxbjUbmkqJG6r7PBCgn8k22Ex3sbmt3ltSKReIxdYGN1IlLC7 GHfyyXf/Qt2wPnhr4blb4d1Uofg33Ig4RhVoZSd/9jSWP97nfGSH1+bIA52KXAUgzKfG ZGuVuK2Knt+a+zhW4uUzn4G4sLihoJrwjLBaTsdX93noZBKY7yKeZpRc6vqUBohbUx8O QVCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702996235; x=1703601035; 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=hrrYVhE07Wh7eZ2uUcxS1QGWEszq2wcLdVswcShO1vQ=; b=X+VTLzeyRPZZahMBUGmy3xxkf4mzS+UT8/Yz++D0LXbFhjfLh8X77jX9CWYqiRbTF+ GuPCB9f3A2feYrMP92uWyjkkePTfWo2Alnt9O5TfngtCHsF9XgpcfFEkpJaAQPpFdHi8 8yY8y0c2JkqUao2DK0xHj5KgyVJAIKrRO0MoWsPCXnrVbd/PePjqcIDUZzcJ+EdsFf3G HL72VH3/fc02esof0sQjnOYwoPIzPUWk3Wcbl7BqixdtdWrrWx8lJbx1IXKcyyzHJwMd sqWSrvNMRvvHARxWV1HeIjb+28AgOkYw6fGlwxw1AMWVNAGblgmuTXMao6Sm/KOFsEiv rKcw== X-Gm-Message-State: AOJu0Yy28QUtbbQjGCyestb1m6VK9/leZTGEgTs0Uze/ExwGfFag08+j SXoGCP0UfNPUONjEKQldF/EfFedPi6tz8V8seHY= X-Google-Smtp-Source: AGHT+IHnCmy5+r7CUTdOEcwF9fwfnVDpLm9tY5Cw28UsliO4mT83zSw3EEd2Lf4YClYnH+yx5EyhTg== X-Received: by 2002:a05:600c:2047:b0:40c:3dd7:98dc with SMTP id p7-20020a05600c204700b0040c3dd798dcmr9348555wmg.75.1702996235365; Tue, 19 Dec 2023 06:30:35 -0800 (PST) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:fe1e:443:c34f:edaa]) by smtp.gmail.com with ESMTPSA id a21-20020a05600c349500b0040c4be1af17sm3224405wmq.21.2023.12.19.06.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:30:34 -0800 (PST) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Plug small loophole in finalization machinery Date: Tue, 19 Dec 2023 15:30:33 +0100 Message-ID: <20231219143034.454911-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: From: Eric Botcazou The path in Expand_N_If_Expression implementing the special optimization for an unidimensional array type and dependent expressions with static bounds fails to call Process_Transients_In_Expression on their list of actions. gcc/ada/ * exp_ch4.adb (Expand_N_If_Expression): Also add missing calls to Process_Transients_In_Expression on the code path implementing the special optimization for an unidimensional array type and dependent expressions with static bounds. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch4.adb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 8f4cf0808dc..527ca16aac4 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5912,6 +5912,14 @@ package body Exp_Ch4 is and then not Generate_C_Code and then not Unnest_Subprogram_Mode then + -- When the "then" or "else" expressions involve controlled function + -- calls, generated temporaries are chained on the corresponding list + -- of actions. These temporaries need to be finalized after the if + -- expression is evaluated. + + Process_Transients_In_Expression (N, Then_Actions (N)); + Process_Transients_In_Expression (N, Else_Actions (N)); + declare Ityp : constant Entity_Id := Base_Type (Etype (First_Index (Typ))); -- 2.43.0