[COMMITTED,28/35] ada: Fix fallout of change in parameter passing out of aliasing considerations
Message ID | 20241025091107.485741-28-poulhies@adacore.com |
---|---|
State | Committed |
Commit | 11e06dd243ac578f81d435ca0aea2ce3340a0650 |
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A27E93858C62 for <patchwork@sourceware.org>; Fri, 25 Oct 2024 09:22:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id D6FAE3857C6D for <gcc-patches@gcc.gnu.org>; Fri, 25 Oct 2024 09:11:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6FAE3857C6D 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 D6FAE3857C6D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847524; cv=none; b=ndqfbIJIyPMCO5EbsVZ8TuXfloFW+xX/qIbOrBlMRy4AuuUmmFA5sX8etBqNIM3W6T5dNJq8Ghn1J7g/OctzM4hNBX/i0yLQ+p+6bfzwTrZgYX9E5QceNI1yLG56W7y7LQG78U0BkA7d9Mabv23CjzcnPjWF0xmMsDMZyCvOPoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847524; c=relaxed/simple; bh=hEr3lHN66ck4vZEKogGd6iNbPSxWXqoYy4gO1la1eno=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BVZzIEf/BcajhkNHagGz46Xd6L2+QiXJZ58As9nqE3N+6k7Kr8rnOIMBKNe6c+g7Vk886qgB35ri78yHGqqGNF21YAyVHhEIJXqeG+lyhdGgwkMag3zh0znWBjxoqtjJOTvOKF35zZYDopUoN+0hi3FEo9odZY8WvDMFf3hvMVs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43163667f0eso18198415e9.0 for <gcc-patches@gcc.gnu.org>; Fri, 25 Oct 2024 02:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1729847512; x=1730452312; 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=kz6IfLs1TyOuU8sZXiv6Q6jLRssb7X0G+PYdwlAp3lw=; b=cIbfTVW9LFYtoAEomVCqVbJe3U7e+wptxR2OZFASJ2cD4pzx77jEusPaIiiVqgRBQc lbKR/Nuh3wr7A5l6XTqecWK4ou/CG4Y94vcK7op2aaLoXCciQR4ENqsgmQxLst6o4v/e lXAKQEy3SCNLjuhE+a3dl62s+GJ4LHNiIhTCgVxxTZm4PY8B5FXk2NOgCNSa9dZbxSe5 d3ptd34A/1hbCs/p4lFTk2KxPzUjbKg2yBRwPBJhFxSqLSpWOnIiOHLK4kLBj6H94x9Z IlVTpygZP4i28xWtWwpwgzae0IfGo5N/cnRKLGdGju8fqaEWciD32csWThlIa4il8rDj nqvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729847512; x=1730452312; 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=kz6IfLs1TyOuU8sZXiv6Q6jLRssb7X0G+PYdwlAp3lw=; b=shGzIfLCCgmzWbSowWICq0tokS4D6McxYhv2WYnMUHm92mgBBMxX4BO0inX3TgFXhU Dncb54CVqR+XpaxkUCnsArxE4eK9+LoUYFCSUX9TKPLB91+tGmTRZYD6yVwYTXyS7eYS 4kxg8jQ9im1rCFVEPYVefHkgXKeg8TjuoYxIfYeUzYnQ2UN/Ovp3Me0u0vouhX/7gcMU Wvp0pViydY+49btPWQ6SwqlI7yEKZFeO4zkeawmlaLL8EHU7TETTMoj65lz/6NE2P1kR jUjkDiRmVbgAcfol2q2kkrc9XcWZMc9C2b9K+QUlPzucx1MPhK6f7W6eahzfjoCbXcDY 0G5Q== X-Gm-Message-State: AOJu0YxGBkDIDVauDp99rOxZmJFKl+GR7IcDTjZsC5Ydn5TnMpFc7QSe VUfCWTOjP74B7NdH7qqSPtc6m2bIRpGh8ltWQmDmjs8sQwpkbMl/CfbNnUhGxLHB9TngIqD+y7I = X-Google-Smtp-Source: AGHT+IEik/hSpBppGDqZHqnf0eYBt1ZjfeMKmIUMAh7Q1J0K8sa21Tg41iTM9mJ4bcnCEXaSiKzICA== X-Received: by 2002:a05:600c:3ca3:b0:426:6e86:f82 with SMTP id 5b1f17b1804b1-4318423bb1amr80760995e9.22.1729847512503; Fri, 25 Oct 2024 02:11:52 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:2626:b78c:6271:6c01]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b47aa8sm1013079f8f.51.2024.10.25.02.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 02:11:51 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou <ebotcazou@adacore.com> Subject: [COMMITTED 28/35] ada: Fix fallout of change in parameter passing out of aliasing considerations Date: Fri, 25 Oct 2024 11:10:57 +0200 Message-ID: <20241025091107.485741-28-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241025091107.485741-1-poulhies@adacore.com> References: <20241025091107.485741-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.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 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
[COMMITTED,01/35] ada: Pass parameters of full access unconstrained array types by copy in calls
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-arm | fail | Patch failed to apply |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | fail | Patch failed to apply |
Commit Message
Marc Poulhiès
Oct. 25, 2024, 9:10 a.m. UTC
From: Eric Botcazou <ebotcazou@adacore.com>
If an actual parameter that is a type conversion is passed by reference but
not addressable, the temporary that is created and whose address is passed
instead may need to be in the target type of the conversion to fulfill the
requirements of strict aliasing.
gcc/ada/ChangeLog:
* gcc-interface/trans.cc (Call_to_gnu): If the formal is passed by
reference and the actual is a type conversion but not addressable,
create the temporary in the target type of the conversion if this
is needed to enforce strict aliasing.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/gcc-interface/trans.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 93f67404ddb..5f8a18eebb7 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -5010,9 +5010,12 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, TREE_TYPE (gnu_name)))) gnu_name = convert (gnu_name_type, gnu_name); - /* If the temporary is created because of aliasing considerations, + /* If the temporary is created because of aliasing considerations, + or would have been so created if the actual was addressable, it must be in the target type of the (unchecked) conversion. */ - if (aliasing) + if (aliasing + || (node_is_type_conversion (gnat_actual) + && !aliasable_p (gnu_name, gnu_actual_type))) { if (Nkind (gnat_actual) == N_Unchecked_Type_Conversion) gnu_name = unchecked_convert (gnu_actual_type, gnu_name,