From patchwork Tue Jan 3 09:35:40 2023 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: 38342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4525521wrt; Tue, 3 Jan 2023 01:42:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXswRO8RrLY+gt4ELWZchYsGfMHlr8fL40dHLxUVdvUnRa76rYltJVd1FDD0EHjqFfZqlwYS X-Received: by 2002:aa7:c1d5:0:b0:489:64aa:d1aa with SMTP id d21-20020aa7c1d5000000b0048964aad1aamr19297492edp.16.1672738960353; Tue, 03 Jan 2023 01:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672738960; cv=none; d=google.com; s=arc-20160816; b=bQHCU4poDTOxoktV9dusvedU8q5Zg+cACb8owZYaBGdLEM08gdjaozHqNd8ZCM1XNS NyEwk1RKWzzGKxqHPUbUL7vhNcfQ0x0mIwMLFSSlSdR/lD+LXJRJ1i+bsdyFdfV8UyrP PjSyztNR/9Zpz4Dra9BvZodSSUQY8muXmVdruXo+HuzuC6YnNFHVvmUarlSJHxShzzeC NOny5Wh4/nbFsi1DvtKzyxU79CbhEWrj+S6FjtTWnZpYYfwjUo/bF9hkeMFaXBpue5zH m+8IHlCRS355AiYfV16x0k8aExg6zn8BQLCaMA4V9oCSoZ9R1csEDaPd0WP2V0T1M1/S SvAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:delivered-to:dkim-signature:dkim-filter; bh=t88A6HYEbJ94bs5IsOtTJdMrRPkFIZcvP+Lt0j9r/0Q=; b=07m3aFq6XGmfUKTkG090SiMJ9jh3vIDgeX6uKBdpZ+saUAkklUE6q2EeorqRTBsc0k pJibTZAVoKDWzU+EjnUWdPaXd8hiyrfnpAGfF+QrddM3yDznDitoT3fXNgK3p8WXl36Y 6hk2w318KeigxluTWG5tXsq+fBkQXSqj0Q3ebK6Pn9mfcUZXPVnu1iy7NcQPUlsyaQ+Q 8a/bQq3Y+6fY74aYNRfWNzUY5FQxzmsqXRea89t96XAo3pROG0ehhuVmtxi/yR/KIM6u LOf++yyndv/ZQCxzpshKgzTrqchcYffuCHu3avjPv7KH9Sg0l7GZgyW9XGHSf2nEnHnR 7KAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rz06Z5QN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e7-20020a056402190700b0048e9c366c0csi4298513edz.236.2023.01.03.01.42.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 01:42:40 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rz06Z5QN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2DD7C388B6B8 for ; Tue, 3 Jan 2023 09:40:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DD7C388B6B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672738804; bh=t88A6HYEbJ94bs5IsOtTJdMrRPkFIZcvP+Lt0j9r/0Q=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=rz06Z5QNfMSQz29a2ND9NQ4snQ9nYtLO3HEs/y2M3wtD5ipkceWuQoME+88Hjw5ok u3O2B7svRTrQS+E1m+/dlXoZxdN8Poe9x/f/JUC21AhiErRIi8Cz2vYXTst2ERIRO/ 9V5FOcqOVuoICw41mh2yoC7VAsqwEB++kXGdXbE0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 617D6385B51A for ; Tue, 3 Jan 2023 09:35:44 +0000 (GMT) Received: by mail-wm1-x333.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so22632026wms.2 for ; Tue, 03 Jan 2023 01:35:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t88A6HYEbJ94bs5IsOtTJdMrRPkFIZcvP+Lt0j9r/0Q=; b=AwZBNsgjlK8fgpSM95x8vPvxz7V+q9Lt+ABVeqgNnrKdGJm+292KymFojwEwDwpvSQ WcxSvJR833n3Mi0amk72LgD7inKG4Q/IQj13TBox/Tbcb/v8eeaC6IXwvq8CF53KADoV zDCYTOBjAIEaUIZ9cXNBexXznSk3HNaswYJiU6L/E0CsbiE3tJinbwbXgd7ixKqj+253 QVOyHocCQ+wD3d58osnTfJoObVgdIpYjJ5RmlYLbLjPnhbYGDrh2v25DYvkCfKWnbVL5 pLUMO8Gd1eWgNJKOAESfhRUpEWtGyA5fe8YSO2haipnrp7mDMnoxNHolSH9CVssdVVrA m72w== X-Gm-Message-State: AFqh2ko2hLVpbjeMTPqDdAf5hYX/qeQhiskLVsvHiB0pmGXGqwqdaytj 9+lSh/vbJb7uDQuV9t3cc5EHckeqESzw88wWK1A= X-Received: by 2002:a05:600c:54ef:b0:3d0:5254:8a43 with SMTP id jb15-20020a05600c54ef00b003d052548a43mr38333192wmb.38.1672738543201; Tue, 03 Jan 2023 01:35:43 -0800 (PST) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id h10-20020a05600c2caa00b003c701c12a17sm50164807wmc.12.2023.01.03.01.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 01:35:42 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Another small adjustment to special resolution of membership test Date: Tue, 3 Jan 2023 10:35:40 +0100 Message-Id: <20230103093540.76431-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753993928085103510?= X-GMAIL-MSGID: =?utf-8?q?1753993928085103510?= From: Eric Botcazou This goes back to the original implementation but keeps the special size test with universal_integer to cope with its limited range. gcc/ada/ * sem_res.adb (Resolve_Membership_Op): Adjust again latest change. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_res.adb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b54ed93a7f7..348d272a399 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -10105,11 +10105,11 @@ package body Sem_Res is then T := Etype (R); - -- If the type of the left operand is universal_integer and that of the - -- right operand is smaller, then we do not resolve the operands to the - -- tested type but to universal_integer instead. If not conforming to - -- the letter, it's conforming to the spirit of the specification of - -- membership tests, which are typically used to guard an operation and + -- If the left operand is of a universal numeric type and the right + -- operand is not, we do not resolve the operands to the tested type + -- but to the universal type instead. If not conforming to the letter, + -- it's conforming to the spirit of the specification of membership + -- tests, which are typically used to guard a specific operation and -- ought not to fail a check in doing so. Without this, in the case of -- type Small_Length is range 1 .. 16; @@ -10127,9 +10127,14 @@ package body Sem_Res is -- for example the large values of Long_Long_Long_Unsigned. elsif not Is_Overloaded (L) - and then Etype (L) = Universal_Integer + and then Is_Universal_Numeric_Type (Etype (L)) and then (Is_Overloaded (R) - or else RM_Size (Etype (R)) < RM_Size (Universal_Integer)) + or else + (not Is_Universal_Numeric_Type (Etype (R)) + and then + (not Is_Integer_Type (Etype (R)) + or else + RM_Size (Etype (R)) < RM_Size (Universal_Integer)))) then T := Etype (L);