From patchwork Thu Aug 1 15:17:17 2024 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: 1967865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=FnNvIgsC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZYB71cmGz1ybV for ; Fri, 2 Aug 2024 01:42:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5DE98384B063 for ; Thu, 1 Aug 2024 15:42:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 5BCA8385ED71 for ; Thu, 1 Aug 2024 15:17:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BCA8385ED71 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 5BCA8385ED71 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=1722525495; cv=none; b=RqOxVmRC5Ykr5RCBTDz1Alg12NVhgO5XaBN8bI1ueH5GZtwraoyYu+M9Q4cTnvjsphpnk2kooU91lLHuapzoErlyCmqNXXDi4ibOWH8r7JLPecBlaGWSewhZNDJT91HgKhPqAi/J5IojsvJdAC1iB9JJ1RjakyaE5ScWU4WSl9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525495; c=relaxed/simple; bh=LU0KSIeQ7fB5gq7c5ml14RAPvdtxfgbqi7htBuanu8M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UcBdBrg9QUE0af2TgPlguLeMt35aPui49DtJ6loDGglGcggqTnXb4CDaKPkgS7nK/ghENfH2AIWSxdF+qhZhlM5m92zm11pbI72RboLuM03SfkxNyUtxBxvh9Zb9HbyrY6GBj2Hxz1IHjEkxbyNJutIgxOOdbW7foofUp97AVmg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-368663d7f80so3573165f8f.3 for ; Thu, 01 Aug 2024 08:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525478; x=1723130278; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qj+4fjrmHZsKyNKX4x9uwGDNrRol9PQ8MYqVTH7+mrs=; b=FnNvIgsCh6OEI2/PwTW7skO16Yf3Upg3PEF+BQiEyBdhH24KGQKftXtjQEYZHRlPEE 0VN5AXzvhNpa5zkru4yG8qGt5f64qhJNiQuj63HKv9V2dLuUqtuGBo6spe4KK/6wdkc9 E1fzDwv31wjwP2Ix7SkBOWisbEXjh0688+Yhm0/VRmgl033mDvyoaNATxcWjZIEPicgm 5PEk7RyN8f90OWHgZGqANPPN7GRBFlmQrF+HRYRK2wDguHH3Dn3CbkmRrepCMS229Lw+ pnKpILox2B7474h8M61nxb8TYuGNc8wzFMiYZulXgUPVH95eWTzUOqgUqstBwPmCp/Ru 5PQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525478; x=1723130278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qj+4fjrmHZsKyNKX4x9uwGDNrRol9PQ8MYqVTH7+mrs=; b=I/IQlRlsD+3PA/yoCPIR6LD2JrtcrsNhY7nFQgqotHcLHcG6jQ0AwN5I7riZb/Rwe5 N2gKpEp88Cu/pLfn5t9YyqmtnE+/YDACW20WlmN0H6bTC2Ybe9GL0q03gX3rEpD5WU9k 1IMzSadnQeX/PRBYM79TII+oqbpL6x+t5YrqH4liOhHWMVcN75ODrKUiiHgZlW9RLEIh UOHz0qcpy9v2COP17QrO1Ad2fBhJsgbGLJTZ1O3ITZYbhm9uI4Tg5FcYpFphPlliAoSA 3KuNqRuUOq59T5CdK2EMYALFKG6ARVhV5vtR7BGEEKyzQRWW0yjn22GGa4NJsPfmrEgL F0iA== X-Gm-Message-State: AOJu0YziCGlK/NELEL5sk7T+mV11PFxL7h5hZLovMXN1m3Jd32gKzc3h TC4TdA/t5mGQAgBZrDJOfROAmK660+CCNZNh4vMOMz/kkAM+w/yKbli8RuEddPa1qkw0+QBneaz OYQ== X-Google-Smtp-Source: AGHT+IHLjO5xW3cWQtWR7Xp2aooN4nOhcASldniGX/uAbwldlBOnT8PB1ce3OQ8ogO6MgFECpGheLA== X-Received: by 2002:adf:e2cf:0:b0:367:909b:8281 with SMTP id ffacd0b85a97d-36bbc17c14amr120832f8f.59.1722525477817; Thu, 01 Aug 2024 08:17:57 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:17:57 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Gary Dismukes Subject: [COMMITTED 09/30] ada: Missing adjust of controlled component initialized from container aggregate Date: Thu, 1 Aug 2024 17:17:17 +0200 Message-ID: <20240801151738.400796-9-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801151738.400796-1-poulhies@adacore.com> References: <20240801151738.400796-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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.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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Gary Dismukes In the case of controlled components initialized by a container aggregate, the compiler was suppressing the call to the needed Adjust operation, because it was suppressed for all aggregates. But container aggregates aren't built in place, so target adjustment should still be done in that case. gcc/ada/ * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Do the component adjustment in the case of initialization by a container aggregate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 1eea062210a..6fee2b41bac 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -2700,10 +2700,12 @@ package body Exp_Ch3 is end if; -- Adjust the component if controlled except if it is an aggregate - -- that will be expanded inline. + -- that will be expanded inline (but note that the case of container + -- aggregates does require component adjustment). if Needs_Finalization (Typ) - and then Nkind (Exp_Q) not in N_Aggregate | N_Extension_Aggregate + and then (Nkind (Exp_Q) not in N_Aggregate | N_Extension_Aggregate + or else Is_Container_Aggregate (Exp_Q)) and then not Is_Build_In_Place_Function_Call (Exp) then Adj_Call :=