[compiler-rt] [ASan] Honor `allocator_may_return_null` when set through user-function and fix large alloc edge case (PR #117929)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 9 01:10:23 PST 2024
================
@@ -0,0 +1,27 @@
+// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: %run %t 2>&1
+// CHECK: Success
+
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <limits>
+
+// On Windows, flags configured through the user-defined function `__asan_default_options`
----------------
zmodem wrote:
This and allocator_may_return_null_limits.cpp are really variations of the same test. I wonder if they could be folded together?
For example, the` __asan_default_options()` definition could be guarded by an `#ifdef` and then you could run multiple invocations on the same file. Something like:
```
// RUN: %clangxx_asan -DASAN_DEFAULT_OPTIONS %s -o %t
// RUN: %run %t 2>&1 | FileCheck --check-prefix=RETURN_NULL
// RUN: %clangxx_asan %s -o %t
// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t 2>&1 | FileCheck --check-prefix=RETURN_NULL
// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t 2>&1 | FileCheck --check-prefix=ABORT
```
https://github.com/llvm/llvm-project/pull/117929
More information about the llvm-commits
mailing list