Skip to content

[libc++] Simplify the implementation of __next_prime a bit #143512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025

Conversation

philnik777
Copy link
Contributor

No description provided.

@philnik777 philnik777 marked this pull request as ready for review June 11, 2025 18:39
@philnik777 philnik777 requested a review from a team as a code owner June 11, 2025 18:39
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jun 11, 2025
@philnik777 philnik777 merged commit 773d357 into llvm:main Jun 11, 2025
33 of 37 checks passed
@philnik777 philnik777 deleted the simplify_hash_cpp branch June 11, 2025 18:39
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/143512.diff

1 Files Affected:

  • (modified) libcxx/src/hash.cpp (+9-11)
diff --git a/libcxx/src/hash.cpp b/libcxx/src/hash.cpp
index 41c4eb480a5fc..50d8cf9f9f539 100644
--- a/libcxx/src/hash.cpp
+++ b/libcxx/src/hash.cpp
@@ -9,7 +9,6 @@
 #include <__hash_table>
 #include <algorithm>
 #include <stdexcept>
-#include <type_traits>
 
 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare")
 
@@ -52,16 +51,15 @@ const unsigned indices[] = {
 // are fewer potential primes to search, and fewer potential primes to divide
 // against.
 
-template <size_t _Sz = sizeof(size_t)>
-inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 4, void>::type __check_for_overflow(size_t N) {
-  if (N > 0xFFFFFFFB)
-    std::__throw_overflow_error("__next_prime overflow");
-}
-
-template <size_t _Sz = sizeof(size_t)>
-inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 8, void>::type __check_for_overflow(size_t N) {
-  if (N > 0xFFFFFFFFFFFFFFC5ull)
-    std::__throw_overflow_error("__next_prime overflow");
+inline void __check_for_overflow(size_t N) {
+  if constexpr (sizeof(size_t) == 4) {
+    if (N > 0xFFFFFFFB)
+      std::__throw_overflow_error("__next_prime overflow");
+  } else {
+    static_assert(sizeof(size_t) == 8);
+    if (N > 0xFFFFFFFFFFFFFFC5ull)
+      std::__throw_overflow_error("__next_prime overflow");
+  }
 }
 
 size_t __next_prime(size_t n) {

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 11, 2025

LLVM Buildbot has detected a new failure on builder clang-hip-vega20 running on hip-vega20-0 while building libcxx at step 3 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/21150

Here is the relevant piece of the build log for the reference
Step 3 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/hip-build.sh --jobs=' (failure)
...
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;hwasan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against "asan;lsan;hwasan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins
[142/146] Linking CXX executable bin/c-index-test
[143/146] Performing build step for 'runtimes'
[0/22] cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build && /usr/bin/cmake --build .
[1/2] /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS="" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -m32 -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
FAILED: libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS="" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -m32 -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp:59:19: error: static assertion failed due to requirement 'sizeof(unsigned int) == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ^~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp:59:34: note: expression evaluates to '4 == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ~~~~~~~~~~~~~~~^~~~
1 error generated.
ninja: build stopped: subcommand failed.
[16/22] cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins && /usr/bin/cmake -E touch /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json && /usr/bin/python3.10 /home/botworker/bbot/clang-hip-vega20/llvm-project/runtimes/../llvm/utils/merge-json.py /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compile_commands.json -o /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json
FAILED: compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/src/libcxx_fuzzer_i386-stamp/libcxx_fuzzer_i386-build /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/src/libcxx_fuzzer_i386-stamp/libcxx_fuzzer_i386-build 
cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build && /usr/bin/cmake --build .
[18/22] /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/x86_64-unknown-linux-gnu/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-stamps/runtimes-build 
cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Step 7 (Building LLVM) failure: Building LLVM (failure)
...
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;hwasan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against "asan;lsan;hwasan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins
[142/146] Linking CXX executable bin/c-index-test
[143/146] Performing build step for 'runtimes'
[0/22] cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build && /usr/bin/cmake --build .
[1/2] /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS="" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -m32 -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
FAILED: libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS="" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -m32 -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp:59:19: error: static assertion failed due to requirement 'sizeof(unsigned int) == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ^~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp:59:34: note: expression evaluates to '4 == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ~~~~~~~~~~~~~~~^~~~
1 error generated.
ninja: build stopped: subcommand failed.
[16/22] cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins && /usr/bin/cmake -E touch /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json && /usr/bin/python3.10 /home/botworker/bbot/clang-hip-vega20/llvm-project/runtimes/../llvm/utils/merge-json.py /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compile_commands.json -o /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/compile_commands.json
FAILED: compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/src/libcxx_fuzzer_i386-stamp/libcxx_fuzzer_i386-build /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/src/libcxx_fuzzer_i386-stamp/libcxx_fuzzer_i386-build 
cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build && /usr/bin/cmake --build .
[18/22] /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/x86_64-unknown-linux-gnu/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/c++/v1 -I/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxxabi/include -I/home/botworker/bbot/clang-hip-vega20/llvm-project/cmake/Modules/../../libc -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fdebug-prefix-map=/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/include/c++/v1=/home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/bbot/clang-hip-vega20/llvm-project/libcxx/src/hash.cpp
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-stamps/runtimes-build 
cd /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/runtimes/runtimes-bins && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
program finished with exit code 1
elapsedTime=44.921908

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 11, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building libcxx at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7140

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
0.866 [3/43/1828] Building CXX object libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_handlers.cpp.o
0.866 [3/42/1829] Building CXX object libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/stdlib_stdexcept.cpp.o
0.877 [3/41/1830] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/mutex.cpp.o
0.884 [3/40/1831] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/error_category.cpp.o
0.956 [3/39/1832] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/stdexcept.cpp.o
0.970 [3/38/1833] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/functional.cpp.o
0.979 [3/37/1834] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/system_error.cpp.o
0.980 [3/36/1835] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/memory_resource.cpp.o
1.013 [3/35/1836] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/bind.cpp.o
1.055 [3/34/1837] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o
FAILED: libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS="" -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxx/src -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1 -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxxabi/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/cmake/Modules/../../libc -m32 -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fdebug-prefix-map=/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_i386/build/include/c++/v1=/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxx/include -std=c++2b -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -MF libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o.d -o libcxx/src/CMakeFiles/cxx_static.dir/hash.cpp.o -c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxx/src/hash.cpp
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxx/src/hash.cpp:59:19: error: static assertion failed due to requirement 'sizeof(unsigned int) == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ^~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libcxx/src/hash.cpp:59:34: note: expression evaluates to '4 == 8'
   59 |     static_assert(sizeof(size_t) == 8);
      |                   ~~~~~~~~~~~~~~~^~~~
1 error generated.
1.139 [3/33/1838] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/vector.cpp.o
1.264 [3/32/1839] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/fstream.cpp.o
1.322 [3/31/1840] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/future.cpp.o
1.341 [3/30/1841] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/random.cpp.o
1.346 [3/29/1842] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/filesystem_error.cpp.o
1.430 [3/28/1843] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/random_shuffle.cpp.o
1.433 [3/27/1844] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/barrier.cpp.o
1.445 [3/26/1845] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/ios.cpp.o
1.449 [3/25/1846] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/memory.cpp.o
1.451 [3/24/1847] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/condition_variable.cpp.o
1.458 [3/23/1848] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/charconv.cpp.o
1.497 [3/22/1849] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/strstream.cpp.o
1.574 [3/21/1850] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/atomic.cpp.o
1.602 [3/20/1851] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/thread.cpp.o
1.628 [3/19/1852] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/ostream.cpp.o
1.647 [3/18/1853] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/print.cpp.o
1.737 [3/17/1854] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/iostream.cpp.o
1.768 [3/16/1855] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/regex.cpp.o
1.820 [3/15/1856] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/path.cpp.o
1.840 [3/14/1857] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/string.cpp.o
1.903 [3/13/1858] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/chrono.cpp.o
1.929 [3/12/1859] Building CXX object libcxx/src/CMakeFiles/cxx_experimental.dir/experimental/chrono_exception.cpp.o
2.028 [3/11/1860] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/filesystem_clock.cpp.o
2.196 [3/10/1861] Building CXX object libcxx/src/CMakeFiles/cxx_experimental.dir/experimental/tzdb_list.cpp.o
2.228 [3/9/1862] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/directory_entry.cpp.o
2.610 [3/8/1863] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/directory_iterator.cpp.o
2.652 [3/7/1864] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/ios.instantiations.cpp.o
2.889 [3/6/1865] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.o
3.243 [3/5/1866] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/algorithm.cpp.o
4.345 [3/4/1867] Building CXX object libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_demangle.cpp.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants