[compiler-rt] [compiler-rt][memprof] memccpy interception (PR #155101)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 14:35:05 PDT 2025


================
@@ -0,0 +1,17 @@
+// RUN: %clangxx_memprof -O0 %s -o %t
+// %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main() {
+  char *p = strdup("memccpy");
+  char *d = (char *)malloc(4);
+  void *r = memccpy(d, p, 'c', 8);
+  int cmp = memcmp(r, "mem", 3);
+  free(d);
+  free(p);
+  return cmp;
+}
+// CHECK: Memory allocation stack id
----------------
teresajohnson wrote:

There are other allocations in this code without the memccpy interception, does this test fail without that support? If not, can the checking be tightened up?

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


More information about the llvm-commits mailing list