[libc-commits] [libc] [libc] Fix HermeticTestUtils signature of operator delete (PR #215041)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Sat Aug 8 17:37:16 PDT 2026
https://github.com/labath created https://github.com/llvm/llvm-project/pull/215041
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).
>From 6646dfe5a96c9c6b5661358c107e52076e3afea2 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Sun, 9 Aug 2026 00:29:41 +0000
Subject: [PATCH] [libc] Fix HermeticTestUtils signature of operator delete
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).
---
libc/test/UnitTest/HermeticTestUtils.cpp | 2 +-
libc/test/src/__support/printf_core/CMakeLists.txt | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
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
More information about the libc-commits
mailing list