[COMMITTED,22/31] ada: Avoid temporary for conditional expression of discriminated record type
Message ID | 20240521073035.314024-22-poulhies@adacore.com |
---|---|
State | Committed |
Commit | e49eac82e805ede5dd9b3c5d4ae9f8d90b0cc034 |
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 821E3385840B for <patchwork@sourceware.org>; Tue, 21 May 2024 07:39:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id C654A3858433 for <gcc-patches@gcc.gnu.org>; Tue, 21 May 2024 07:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C654A3858433 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 C654A3858433 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; cv=none; b=YbrFewcrzuziyF+sy/JLbcRagcgJb1mhZOKg1euDenqmsaH9PFU2qz4qZnTcLqdFtMxA6GC6CL83bg00RShiv0O4bmxuYOwnQtDPTZbl8GYGZfaZVbb0x225t57Z0I7SZTHeQB5I9/Q4YFwE0kbwxfeAzXqkhVakjgjaS5dwfOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276667; c=relaxed/simple; bh=i3/9DJvOqeTXtt/1GWRMxveR2Qiaj8qhKiJkvVJFRJA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rMDesvZA2BIv9QAdlTF+moRj7T9SE3924T/NifHAMHCsyKDxclIBoryi8xXWKamlUcbL74p1flYe4X4yXxIqO57dLdF1zigm/xr5NJWy/SMmpbUhmzj161SYDFVklVx3cFPpfZGNAPeOwcFZXxuUXiRfIq4JHcCS6h3UMPqcCkA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42016c8daa7so27115625e9.2 for <gcc-patches@gcc.gnu.org>; Tue, 21 May 2024 00:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276664; x=1716881464; 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=GwQDMFIXUXSC0Z8l2EpUO06P7piyZYBT/EJGIqjctCU=; b=S0uJxEaE5fwuXTXjGDyYo4U9jdi9hS3XQJ1jv3gRTAFPbXmZTG0a6aOU9Iku8cjdBd JwZyOF65SSjyOA0bwH/K49+Uh5fS0KbkL+6gnqbKyV8OCObKftwUw7PpjaeoxYGjEl5W 2+aOl6jzB9plgucLvMEdprr1QJm89vK1X0tZ1oben0JxEbhtTue3mfdzF5B3RNw5sFPY rgYPOT2eyxgsWgeRSWBvTMlCOlo9fJmY65/YwHpW/8hV5wJJpuWOVl7sUw74EZaWY6Fr 8gPur8s7qtQZcacvRvEEd/gW2vl6cINLC+O+JVsuJzNlnLWTvdoEnJs+VssvztCWNoaQ 1mzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276664; x=1716881464; 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=GwQDMFIXUXSC0Z8l2EpUO06P7piyZYBT/EJGIqjctCU=; b=Ca9iyUFG09knCBKiC9X0XX+gmRaJJPmCK9qAR3iT3MQOMXQ108vpx+u3+52Km6ez50 2becqHPCHblNY4rx/cjefu775CTyxLb+tifz0MEMUN5fkK5nXKj68yEZRmk4K49tBuZr mhqpIh6DMPLfttlCLpkoyKp1ODJ5RzyLznRgYLE/MA2R0KfW4fgeayyb1wQL/Zyu9+U2 RUqu9qYiXAsocrwso0+Pt0s3iDwuq9k605ArZrs+93ZTl6CkXZVdmUiz4dgG3XaHDxO4 GDKgnxqNQxANADDIql6+tWGnxc6hKZnzB4rf/Z/K2fD7SlhTITAElQ0WCFOLd4+SkQlV GHEA== X-Gm-Message-State: AOJu0YwpnLE5Zu3asUTI0rQhjrPjRFhO5GfIrRJGJDs2cOZLHIfxUwqC nP8shEayDPurUdL9ZoJcSjLSeEm5z0ExzL0PXYB45s4jhllf9pMeC52LW+VVq0RhtMhbk1d1tso = X-Google-Smtp-Source: AGHT+IHXR3rZYCAoMvZuyraajVZOn4np+9TWT9Ay94avDzxeSqPLzDcALp3yEf5aypLYM5F8TtWn8w== X-Received: by 2002:a05:600c:1914:b0:420:112e:6c1 with SMTP id 5b1f17b1804b1-420112e06d1mr214851465e9.13.1716276664637; Tue, 21 May 2024 00:31:04 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:04 -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 22/31] ada: Avoid temporary for conditional expression of discriminated record type Date: Tue, 21 May 2024 09:30:25 +0200 Message-ID: <20240521073035.314024-22-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 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/31] ada: Add new Mingw task priority mapping
|
|
Commit Message
Marc Poulhiès
May 21, 2024, 7:30 a.m. UTC
From: Eric Botcazou <ebotcazou@adacore.com>
This just aligns the definite case (discriminants with default) with the
indefinite case (discriminants without default), the latter case having
been properly handled for long. In the former case, the maximum size is
used so a temporary can be much larger than the actual data it contains.
gcc/ada/
* gcc-interface/utils2.cc (build_cond_expr): Use the indirect path
for all types containing a placeholder.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/gcc-interface/utils2.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index a953b070ed8..fb0ccf59224 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1715,8 +1715,8 @@ build_cond_expr (tree result_type, tree condition_operand, then dereference the result. Likewise if the result type is passed by reference, because creating a temporary of this type is not allowed. */ if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE - || TYPE_IS_BY_REFERENCE_P (result_type) - || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) + || type_contains_placeholder_p (result_type) + || TYPE_IS_BY_REFERENCE_P (result_type)) { result_type = build_pointer_type (result_type); true_operand = build_unary_op (ADDR_EXPR, result_type, true_operand);