[libcxx-commits] [libcxx] [libcxx] Fix libcxx test, integral.pass.cpp (PR #135355)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 11 05:26:50 PDT 2025


https://github.com/saturn691 created https://github.com/llvm/llvm-project/pull/135355

Remove `strtoll` functions for testing i128/u128.

Under AArch64, long long is defined as i64. When running the test integral.pass.cpp, it calls tries to call `strtoll`, which returns an i64, not an i128, therefore only keeping the lower 64 bits.

>From 91dc6d4bcdad59d3f7b96cf18d3577307151753a Mon Sep 17 00:00:00 2001
From: William Huynh <William.Huynh at arm.com>
Date: Fri, 11 Apr 2025 10:21:19 +0100
Subject: [PATCH] [libcxx] Fix libcxx test, integral.pass.cpp

Remove `strtoll` functions for testing i128/u128.
Under AArch64, long long is defined as i64. When running the test
integral.pass.cpp, it calls tries to call `strtoll`, which returns
an i64, not an i128, therefore only keeping the lower 64 bits.
---
 libcxx/test/support/charconv_test_helpers.h | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/libcxx/test/support/charconv_test_helpers.h b/libcxx/test/support/charconv_test_helpers.h
index fcae09478457b..89927df02e56d 100644
--- a/libcxx/test/support/charconv_test_helpers.h
+++ b/libcxx/test/support/charconv_test_helpers.h
@@ -19,7 +19,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <type_traits>
-
 #include "test_macros.h"
 
 #if TEST_STD_VER < 11
@@ -163,15 +162,6 @@ struct to_chars_test_base
 #ifndef TEST_HAS_NO_INT128
     static TEST_CONSTEXPR_CXX23 __int128_t fromchars128_impl(char const* p, char const* ep, int base, true_type)
     {
-        if (!TEST_IS_CONSTANT_EVALUATED) {
-            char* last;
-            __int128_t r = strtoll(p, &last, base);
-            if(errno != ERANGE) {
-                assert(last == ep);
-                return r;
-            }
-        }
-
         // When the value doesn't fit in a long long use from_chars. This is
         // not ideal since it does a round-trip test instead if using an
         // external source.
@@ -185,15 +175,6 @@ struct to_chars_test_base
 
     static TEST_CONSTEXPR_CXX23 __uint128_t fromchars128_impl(char const* p, char const* ep, int base, false_type)
     {
-        if (!TEST_IS_CONSTANT_EVALUATED) {
-            char* last;
-            __uint128_t r = strtoull(p, &last, base);
-            if(errno != ERANGE) {
-                assert(last == ep);
-                return r;
-            }
-        }
-
         __uint128_t r;
         std::from_chars_result s = std::from_chars(p, ep, r, base);
         assert(s.ec == std::errc{});



More information about the libcxx-commits mailing list