From patchwork Thu Jul 1 16:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1499664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=oGn6CqB1; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GG3JN75kQz9sSs for ; Fri, 2 Jul 2021 02:17:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 431A9397201B for ; Thu, 1 Jul 2021 16:17:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 8CDE33971C37 for ; Thu, 1 Jul 2021 16:16:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8CDE33971C37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x32d.google.com with SMTP id b14-20020a1c1b0e0000b02901fc3a62af78so630332wmb.3 for ; Thu, 01 Jul 2021 09:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=DgLy+KSWoykAZhAhjE5nkTFOwLoSYg2Zj5ol2kFol/k=; b=oGn6CqB1GITJcVn+i7xysioGhObrmHD36Ge/1mPxyaBINSfMiefgJJzA93xGltuXsP TUpu4ndMNe7YVNHVaFu5ANUzc51P/3KpNVjLIKY+blbIeKq1ROClc0Eka9MVmnPm0Dk9 infSHoTJkfIs+xkoOqg9BZUqhqz8VzlKDlCxKylGM1FfipKQIvpXcYqqaoRs2I+tG+re GrXSskQsB5DTFfDoaUrUfdLpOAXChnrLt1EN82xK6io/j7cY1v9vkQoXV2+hejnCDGrk jIPz8F0ICR99h3pFVKrR77wZG2YeQiilJCdM1aVNjfzXEN0GUINwdbMo/2rqv1KO+UpS 1QnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=DgLy+KSWoykAZhAhjE5nkTFOwLoSYg2Zj5ol2kFol/k=; b=fIoQtq3IzamLthlADxI9dYJqSfUPHfBfcuKZ9EnjfwIsfZ49edwQx8gJGxIt2Sx5hM juBHRfxkvAfzH2wz0G+gbLeQRbcSbfb2jnxqlSJS9F3wLsEAHYnGogkWM7swZSOAW0mS ueso3CKQvxpBf7nhXHZ9MT5qZ8ibp2rTs5pWDjTVqKvfXiFZ/wVjhPhDxJkzxMdjxVUx wr6X5mlmY7W+evp3HsZhLqBS8pi5qgajxU7ky5kgyKG9vnzjFwzxbAtdGgKrZ7i8kge2 q8IVfb2YMy12/7vlY9htZsOYKbBcWSErAJmt3dFDUktR4ymrtRo1uEUkwPvqS2AMEFB+ Yw8Q== X-Gm-Message-State: AOAM5303O6hukfae83I1RXgei2FVsUZ5W8Jwt/Tw91qRY4bLLwXwmm0B lTNU9Ycy0CE7exGS60+S0yPynTIvbWUuCuow X-Google-Smtp-Source: ABdhPJwp8FVIHq/zMcAb7W+yqa7AL12dFTpfyC0K9nqpimjlwgZ0W2SnnJd/SVY9Cjww4BmRZNLKOQ== X-Received: by 2002:a7b:cd99:: with SMTP id y25mr11705721wmj.184.1625156161721; Thu, 01 Jul 2021 09:16:01 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id d17sm359397wro.93.2021.07.01.09.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 09:16:01 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR ada/101094 Date: Thu, 01 Jul 2021 18:15:12 +0200 Message-ID: <2097706.NgBsaNRSFp@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 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 Sender: "Gcc-patches" This is a minor regression present on mainline and 11 branch, whereby the value of the Enum_Rep attribute is always unsigned. Tested on x86-64/Linux, applied on the mainline and 11 branch. 2021-07-01 Eric Botcazou PR ada/101094 * exp_attr.adb (Get_Integer_Type): Return an integer type with the same signedness as the input type. diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 400398dcbc5..9dd3d9d9726 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -1851,14 +1851,13 @@ package body Exp_Attr is ---------------------- function Get_Integer_Type (Typ : Entity_Id) return Entity_Id is - Siz : constant Uint := Esize (Base_Type (Typ)); + Siz : constant Uint := Esize (Base_Type (Typ)); begin -- We need to accommodate invalid values of the base type since we - -- accept them for Enum_Rep and Pos, so we reason on the Esize. And - -- we use an unsigned type since the enumeration type is unsigned. + -- accept them for Enum_Rep and Pos, so we reason on the Esize. - return Small_Integer_Type_For (Siz, Uns => True); + return Small_Integer_Type_For (Siz, Uns => Is_Unsigned_Type (Typ)); end Get_Integer_Type; ---------------------------------