[compiler-rt] [llvm] [compiler-rt][asan] Add asan checks for __builtin_assume_dereferencable (PR #190871)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 16:30:22 PDT 2026


================
@@ -0,0 +1,96 @@
+// RUN: %clangxx_asan -O0 -mllvm -asan-instrument-assume-dereferenceable=1 -fsanitize-recover=address %s -o %t && %env_asan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void test_malloc_fully_oob() {
+  char *p = (char *)malloc(10);
+  fprintf(stderr, "test_malloc_fully_oob: %p\n", p);
+  // CHECK: test_malloc_fully_oob: [[PTR1:0x[0-9a-f]+]]
+  // CHECK: ERROR: AddressSanitizer: assume-dereferenceable-failed on address [[PTR1]]
+  // CHECK: ASSUMPTION of size 20 at [[PTR1]] thread T0
----------------
PiJoules wrote:

Done

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


More information about the llvm-commits mailing list