[libc-commits] [libc] [libc] Fix HermeticTestUtils signature of operator delete (PR #215041)

via libc-commits libc-commits at lists.llvm.org
Sat Aug 8 17:37:55 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Pavel Labath (labath)

<details>
<summary>Changes</summary>

The signed-and-aligned version should take a size_t. It was added to support rv32 #<!-- -->67457, where it worked presumably because size_t is defined as `unsigned int`.

This should fix printf_core.parser_test on amdgpu, which failed to link because it generated a call to the operator (while other targets do not). I did not try this with a GPU build, but I've verified this fixes the same error in x86 builds (when deleting an overaligned struct).

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


2 Files Affected:

- (modified) libc/test/UnitTest/HermeticTestUtils.cpp (+1-1) 
- (modified) libc/test/src/__support/printf_core/CMakeLists.txt (-1) 


``````````diff
diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 84b56e8252eac..9b1987509e6b8 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -144,6 +144,6 @@ enum class align_val_t : size_t {};
 
 void operator delete(void *ptr, std::align_val_t) noexcept { free(ptr); }
 
-void operator delete(void *ptr, unsigned int, std::align_val_t) noexcept {
+void operator delete(void *ptr, size_t, std::align_val_t) noexcept {
   free(ptr);
 }
diff --git a/libc/test/src/__support/printf_core/CMakeLists.txt b/libc/test/src/__support/printf_core/CMakeLists.txt
index bcc5a21ca4ee8..0314b1d7cfd01 100644
--- a/libc/test/src/__support/printf_core/CMakeLists.txt
+++ b/libc/test/src/__support/printf_core/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_libc_test(
   parser_test
-  UNIT_TEST_ONLY # Fails to link on GPUs
   SUITE
     libc-support-tests
   SRCS

``````````

</details>


https://github.com/llvm/llvm-project/pull/215041


More information about the libc-commits mailing list