[llvm-branch-commits] [compiler-rt] [ubsan] Runtime and driver support for local-bounds (PR #120515)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 19 09:34:56 PST 2024


================
@@ -14,12 +15,17 @@ __attribute__((noinline)) void init(S *s) {
   __asm__ __volatile__("" : : "r"(s) : "memory");
 }
 
-__attribute__((noinline, no_sanitize("memory"))) int test(char i) {
+__attribute__((noinline, no_sanitize("memory", "address", "hwaddress"))) int
+test(char i) {
   S a;
   init(&a);
   S b;
   init(&b);
   return ((int *)(&a))[i];
+  // CHECK: error: access out of bounds
+  // CHECK: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
+  // LINE: local_bounds.cpp:[[@LINE-3]]:{{.*}}runtime error: access out of bounds
----------------
MaskRay wrote:

`[[#@LINE-3]]` for new tests. `[[@LINE]]` is deprecated

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


More information about the llvm-branch-commits mailing list