https://gcc.gnu.org/g:7fa1bd660a8a501671a84ca6421db1fc63ce8654

commit r16-900-g7fa1bd660a8a501671a84ca6421db1fc63ce8654
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue May 27 12:06:01 2025 +0100

    libstdc++: Fix test failures for 32-bit AIX
    
    With -maix32 (the default) we only have 16-bit wchar_t so these tests
    fail. The debug.cc one is because we use -fwide-exec-charset=UTF-32BE
    which tries to encode each wide character as four bytes in a 2-byte
    wchar_t. The format.cc one is because the clown face character can't be
    encoded in a single 16-bit wchar_t.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/std/format/debug.cc: Disable for targets with 16-bit
            wchar_t.
            * testsuite/std/format/functions/format.cc: Use -DUNICODE for
            targets with 32-bit wchar_t.
            (test_unicode) [UNICODE]: Only run checks when UNICODE is
            defined.

Diff:
---
 libstdc++-v3/testsuite/std/format/debug.cc            | 1 +
 libstdc++-v3/testsuite/std/format/functions/format.cc | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/libstdc++-v3/testsuite/std/format/debug.cc 
b/libstdc++-v3/testsuite/std/format/debug.cc
index 6165a2954963..965b4dfbebc5 100644
--- a/libstdc++-v3/testsuite/std/format/debug.cc
+++ b/libstdc++-v3/testsuite/std/format/debug.cc
@@ -1,6 +1,7 @@
 // { dg-options "-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE 
-DUNICODE_ENC" { target le } }
 // { dg-options "-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32BE 
-DUNICODE_ENC" { target be } }
 // { dg-do run { target c++23 } }
+// { dg-require-effective-target 4byte_wchar_t }
 // { dg-add-options no_pch }
 // { dg-timeout-factor 2 }
 
diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc 
b/libstdc++-v3/testsuite/std/format/functions/format.cc
index 93c33b456e64..e4adf3aeb706 100644
--- a/libstdc++-v3/testsuite/std/format/functions/format.cc
+++ b/libstdc++-v3/testsuite/std/format/functions/format.cc
@@ -1,6 +1,7 @@
 // { dg-options "-fexec-charset=UTF-8" }
 // { dg-do run { target c++20 } }
 // { dg-add-options no_pch }
+// { dg-additional-options "-DUNICODE" { target 4byte_wchar_t } }
 
 #include <format>
 
@@ -511,6 +512,7 @@ test_bool()
 void
 test_unicode()
 {
+#ifdef UNICODE
   // Similar to sC example in test_std_examples, but not from the standard.
   // Verify that the character "🤡" has estimated field width 2,
   // rather than estimated field width equal to strlen("🤡"), which would be 4,
@@ -564,6 +566,7 @@ test_unicode()
     std::string sA = std::format("{:>5}", input[0]);
     VERIFY( sA == input[1] );
   }
+#endif
 }
 
 int main()

Reply via email to