From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 30C803858414; Tue, 3 Jan 2023 09:34:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30C803858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672738444; bh=2VEeNpDrSSGpPwBLHsiGuFLzM9FdSMSzGAP/Rnp3IIM=; h=From:To:Subject:Date:From; b=uHgi5l/GIjmwqNhBjzexyLjIx3+OLfp/Ads46fXJaq9JBURefJFA2UTbNz1sUW8Ko f0uU0EcfyyV0iVXPeWPwfmdYAo5MmQjmPlpv1xfkEI6gFaIZBL1wmK5lfdb0LGmzBa x273/t2POl682VG5/AGbHHydJN6/NkiU0hRq+L8Y= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4964] ada: Another small adjustment to special resolution of membership test X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 83d52e6de23f65cefde615183cdef1eb94d18b1f X-Git-Newrev: 48d9f7cb215f1af996788aee07808339a786a18d Message-Id: <20230103093404.30C803858414@sourceware.org> Date: Tue, 3 Jan 2023 09:34:04 +0000 (GMT) List-Id: https://gcc.gnu.org/g:48d9f7cb215f1af996788aee07808339a786a18d commit r13-4964-g48d9f7cb215f1af996788aee07808339a786a18d Author: Eric Botcazou Date: Wed Dec 7 17:54:37 2022 +0100 ada: Another small adjustment to special resolution of membership test 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. Diff: --- 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);