[compiler-rt] sanitizer_common: add unsupported test for free_sized and free_aligned_sized from C23 (PR #144727)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 08:28:43 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Justin King (jcking)

<details>
<summary>Changes</summary>



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


2 Files Affected:

- (added) compiler-rt/test/sanitizer_common/TestCases/Linux/free_aligned_sized.c (+13) 
- (added) compiler-rt/test/sanitizer_common/TestCases/Linux/free_sized.c (+15) 


``````````diff
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/free_aligned_sized.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/free_aligned_sized.c
new file mode 100644
index 0000000000000..27cc8752f2841
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/free_aligned_sized.c
@@ -0,0 +1,13 @@
+// RUN: %clang -std=c23 -O0 %s -o %t && %run %t
+// UNSUPPORTED: asan, hwasan, rtsan, tsan, msan, lsan, ubsan
+
+#include <stddef.h>
+#include <stdlib.h>
+
+extern void free_aligned_sized(void* p, size_t alignment, size_t size);
+
+int main() {
+  volatile void *p = aligned_alloc(128, 1024);
+  free_aligned_sized((void*)p, 128, 1024);
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/free_sized.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/free_sized.c
new file mode 100644
index 0000000000000..b3a469b838694
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/free_sized.c
@@ -0,0 +1,15 @@
+// RUN: %clang -std=c23 -O0 %s -o %t && %run %t
+// UNSUPPORTED: asan, hwasan, rtsan, tsan, msan, lsan, ubsan
+
+#include <stddef.h>
+#include <stdlib.h>
+
+extern void *aligned_alloc(size_t alignment, size_t size);
+
+extern void free_sized(void* p, size_t size);
+
+int main() {
+  volatile void *p = malloc(64);
+  free_sized((void*)p, 64);
+  return 0;
+}

``````````

</details>


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


More information about the llvm-commits mailing list