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

Justin King via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 09:31:47 PDT 2025


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

>From 0688a6c4aa99761d7283ef5af7f8fa797f635672 Mon Sep 17 00:00:00 2001
From: Justin King <jcking at google.com>
Date: Wed, 18 Jun 2025 09:31:26 -0700
Subject: [PATCH] sanitizer_common: add unsupported test for free_sized and
 free_aligned_sized from C23

Signed-off-by: Justin King <jcking at google.com>
---
 .../TestCases/Linux/free_aligned_sized.c          | 13 +++++++++++++
 .../sanitizer_common/TestCases/Linux/free_sized.c | 15 +++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 compiler-rt/test/sanitizer_common/TestCases/Linux/free_aligned_sized.c
 create mode 100644 compiler-rt/test/sanitizer_common/TestCases/Linux/free_sized.c

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..f4c6c0f973bdb
--- /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..0ee2289684d0a
--- /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;
+}



More information about the llvm-commits mailing list