public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-3876] fold-const: Handle BITINT_TYPE in range_check_type
@ 2023-09-12 11:17 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2023-09-12 11:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b24fd3bccf76821b46c52cf375e460b7e64d4139

commit r14-3876-gb24fd3bccf76821b46c52cf375e460b7e64d4139
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 12 13:08:54 2023 +0200

    fold-const: Handle BITINT_TYPE in range_check_type
    
    When discussing PR111369 with Andrew Pinski, I've realized that
    I haven't added BITINT_TYPE handling to range_check_type.  Right now
    (unsigned) max + 1 == (unsigned) min for signed _BitInt,l so I think we
    don't need to do the extra hops for BITINT_TYPE (though possibly we don't
    need them for INTEGER_TYPE either in the two's complement word and we don't
    support anything else, though I really don't know if Ada or some other
    FEs don't create weird INTEGER_TYPEs).
    
    2023-09-12  Jakub Jelinek  <jakub@redhat.com>
    
            * fold-const.cc (range_check_type): Handle BITINT_TYPE like
            OFFSET_TYPE.

Diff:
---
 gcc/fold-const.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index d19b4666c652..c5ac82200c8e 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -5565,7 +5565,12 @@ range_check_type (tree etype)
       else
 	return NULL_TREE;
     }
-  else if (POINTER_TYPE_P (etype) || TREE_CODE (etype) == OFFSET_TYPE)
+  else if (POINTER_TYPE_P (etype)
+	   || TREE_CODE (etype) == OFFSET_TYPE
+	   /* Right now all BITINT_TYPEs satisfy
+	      (unsigned) max + 1 == (unsigned) min, so no need to verify
+	      that like for INTEGER_TYPEs.  */
+	   || TREE_CODE (etype) == BITINT_TYPE)
     etype = unsigned_type_for (etype);
   return etype;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-12 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 11:17 [gcc r14-3876] fold-const: Handle BITINT_TYPE in range_check_type Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).