[COMMITTED,05/31] ada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call.
Message ID | 20250107125350.619654-5-poulhies@adacore.com |
---|---|
State | New |
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 E6DF83851161 for <patchwork@sourceware.org>; Tue, 7 Jan 2025 13:02:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6DF83851161 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=P0EkSSAW X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 2FF7B3856095 for <gcc-patches@gcc.gnu.org>; Tue, 7 Jan 2025 12:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2FF7B3856095 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 2FF7B3856095 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254452; cv=none; b=TQe3DF/EmonbNcqldOokT8fs/biiWWIdk5reaLdTvHRvIUlQfFmUL0hgztPFlaX4X9ZZaSvdmPF1noXfDaE7YyMl37TAEL/utxJADdl1nyQgw9OBIYNJljLBPow0flWjktDPLou/25sNp09FPF9xt3vwRssUVX//CuUaHTq/JY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254452; c=relaxed/simple; bh=biUP2I5ZNJ3lekpu+7H18rbSw862sDHCSbaSC11GcK4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LwVNwNyYkVUL9MjY36cQik7PQrPqy2Ok3F5gNc25XXe1CBGK2p+6SASw7ckUJqdKORMFUG8aMa0TUSXsgQgp/o8WIVvcK50al6+UmJ4mpHjCnUjLPikh/uG9XRdKWx1h3LR23um6mNrpbdp/goSTnv/1lXwLKSnHsp3LasSp33M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FF7B3856095 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso110927625e9.1 for <gcc-patches@gcc.gnu.org>; Tue, 07 Jan 2025 04:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254451; x=1736859251; 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=DuyukXvl/Fq4pS6RypR09QcvOjZlSnEsVMJhX4C8P+4=; b=P0EkSSAWD0lYN2Us216S2tM/MsrWgScG9pUTdPenMZVA1Er0h/DBjsFjc0V1unC0Sz iMFU1O5bzoIEjla2bWKSetK2fumvGoyXD3zXzdarnsh5zLOwHbRIEznJRpL/twybgc6O tLhyxTZe81OIujRynaUGXYirAkAiy107znL3gFvtw69tRrNEsQUVsaUU8gYoNckivtTe HbAm6iYTkolsZ9CmPBaqSnlppE/3443IFuF17ZYCLGdzb9NzEds7Lwe2DHpY/qMwV/8b UqXiBCEMMFoS5p9gmMofTs1VPYinOptqSj/q5lYkt4zcFql0KziNRifKOPnmyL8uxpw7 bJGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254451; x=1736859251; 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=DuyukXvl/Fq4pS6RypR09QcvOjZlSnEsVMJhX4C8P+4=; b=DUXlvvvz1S5lWgmssjMx4JRZUEE0uco0yO3W5LEkfx5e+xqLuY+436XRpriaCw5Fwy ssF/MLxcmhV+tBbdx7J2l91Hh2s/zYUK+rbbYG/9mWdAXYyXLnLp+aEUT+Jq7t/JQjZm BlbUuSc58H9vwxnOHZ+h7QzMVOyl0nV9O3uE9TT2U95v6Wfnw6yJXr7DnIT2PKViubMC iQrxKO4J0+PNwQ7etyPXwV9gd4VnUx6yzG4y7HLBZsXqWMxekDKC+NyUa5uzrDF/+PHC AU7kdyQXThz/W+2aUdqts9RE+kzcwRl8DddjOZFXETbV5y85Ql/3Ufa7NFBW6Fonn2iB u5Dg== X-Gm-Message-State: AOJu0YyNM3IyDtEFoXMbh15BNIoMi/6F5iX+9kSNgmGh5rrt61Tt7FIU EtA6XHSc4C52Qccmgp1xgZQi0h7pBCZOkxakCrb+x1dnkiGSPKRf0dswv8TAK59huHLdTL+db1M = X-Gm-Gg: ASbGncvK8HcqlNOHZnQTNHfS95TwTOsFaGtuiP/pV11jxM2yLtvOP7/GGOo1UizR+ic hDn2gzJ2owKMdRrtg8o1EYLHYfjJzOlcCRMIT4GsXX5qnBpV5Q2FjXDrB5r0ltcoK9g5JG8pAN4 iU8k7/rwx0yDz+/8rRNH/adXLS8yFyJKAnN+PPUoO094B/VW8Gf+XaIudkqaKIgPIpD1YSB8eCK TXMiBAH2zaUpBVYakylldqBZrK84UKtpAyydNXE6ym/1FJF/pvYqqZR2P7DLnbfJ5LPUbuQNNQ+ j13qt//CVKPOhIfYe8ktgnF8+5gWYxX4hZcs4Ssrl+DncYYZz3QEBx43sh5lSbzLhhpolUk0 X-Google-Smtp-Source: AGHT+IHoozFyDHaQ52JIyF57arZJm2vEdVKsJbia8y8GZnuEwin4h4Ccil3C0lH+rDEAVP8gI9R06g== X-Received: by 2002:a05:600c:3150:b0:434:9fac:b158 with SMTP id 5b1f17b1804b1-4366854718emr408068365e9.1.1736254450800; Tue, 07 Jan 2025 04:54:10 -0800 (PST) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:10 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Steve Baird <baird@adacore.com> Subject: [COMMITTED 05/31] ada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call. Date: Tue, 7 Jan 2025 13:53:23 +0100 Message-ID: <20250107125350.619654-5-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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/31] ada: Restrict previous change made to expansion of allocators
|
|
Commit Message
Marc Poulhiès
Jan. 7, 2025, 12:53 p.m. UTC
From: Steve Baird <baird@adacore.com>
If a Put_Image aspect specification (introduced in Ada 2022) is given for a
fixed point type Fx, then in some cases a call to Fx'Base'Image would
incorrectly ignore the aspect specification and would instead return the
pre-Ada2022 version of the image. However, a call to Fx'Image would do the
right thing.
gcc/ada/ChangeLog:
* exp_put_image.adb (Image_Should_Call_Put_Image): Cope with the case
where the attribute prefix for an Image attribute reference
denotes an Itype constructed for a fixed point type. Calling
Has_Aspect with such an Itype misses applicable aspect
specifications; we need to look on the right list. This comes up
if the prefix of the attribute reference is
Some_Fixed_Point_Type'Base.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_put_image.adb | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index dff9bba55a8..ef4494b7f11 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -1176,11 +1176,28 @@ package body Exp_Put_Image is declare U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N))); begin - if Has_Aspect (U_Type, Aspect_Put_Image) then + if Has_Aspect (U_Type, Aspect_Put_Image) + or else not Is_Scalar_Type (U_Type) + then + return True; + end if; + + -- Deal with Itypes. One case where this is needed is for a + -- fixed-point type with a Put_Image aspect specification. + + -- ??? Should we be checking for Itype case here, or in Has_Aspect? + -- In other words, do we want to do what we are doing here for all + -- aspects, not just for Put_Image? + + if Is_Itype (U_Type) + and then Has_Aspect (Defining_Identifier + (Associated_Node_For_Itype (U_Type)), + Aspect_Put_Image) + then return True; end if; - return not Is_Scalar_Type (U_Type); + return False; end; end Image_Should_Call_Put_Image;