[gcc r16-4392] libstdc++: Fix check for 7-bit ASCII characters

Jonathan Wakely redi@gcc.gnu.org
Mon Oct 13 10:04:59 GMT 2025


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

commit r16-4392-gfc74f4f0a2cf8372d00c1e5f228138051c3b7864
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 10 23:16:22 2025 +0100

    libstdc++: Fix check for 7-bit ASCII characters
    
    This should check for c <= 0x7f not x < 0x7f, because 0x7f is an ASCII
    character (DEL).
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/unicode.h (__is_single_code_unit): Fix check for
            7-bit ASCII characters.
    
    Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>

Diff:
---
 libstdc++-v3/include/bits/unicode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/unicode.h b/libstdc++-v3/include/bits/unicode.h
index 88e97d41a9eb..00efbe89ca8e 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -61,7 +61,7 @@ namespace __unicode
     __is_single_code_unit(char32_t __c)
     {
       if constexpr (__gnu_cxx::__int_traits<_CharT>::__max <= 0xFF)
-	return __c < 0x7F; // ASCII character
+	return __c <= 0x7F; // ASCII character
       else
 	return __c < __gnu_cxx::__int_traits<_CharT>::__max
 		       && __is_scalar_value(__c);


More information about the Libstdc++-cvs mailing list