[gcc r16-1600] value-range: Use int instead of uint for wi::ctz result [PR120746]

Jakub Jelinek jakub@gcc.gnu.org
Sat Jun 21 14:11:18 GMT 2025


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

commit r16-1600-gb76779c7cd6b92f167a80f16f11f599eea4dfc67
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jun 21 16:09:08 2025 +0200

    value-range: Use int instead of uint for wi::ctz result [PR120746]
    
    uint is some compatibility type in glibc sys/types.h enabled in misc/GNU
    modes, so it doesn't exist on many hosts.
    Furthermore, wi::ctz returns int rather than unsigned and the var is
    only used in comparison to zero or as second argument of left shift, so
    I think just using int instead of unsigned is better.
    
    2025-06-21  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/120746
            * value-range.cc (irange::snap): Use int type instead of uint.

Diff:
---
 gcc/value-range.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index ce13acc312d2..23a5c66ed5e3 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -2287,7 +2287,7 @@ bool
 irange::snap (const wide_int &lb, const wide_int &ub,
 	      wide_int &new_lb, wide_int &new_ub)
 {
-  uint z = wi::ctz (m_bitmask.mask ());
+  int z = wi::ctz (m_bitmask.mask ());
   if (z == 0)
     return false;


More information about the Gcc-cvs mailing list