Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / asan_preload_test-2.cpp
blob817c560d42abbed0fd9e6773ef6190c98bb7ecc9
1 // Test that preloaded runtime works with unsanitized executables.
2 //
3 // RUN: %clangxx %s -o %t
4 // RUN: env LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: asan-dynamic-runtime
8 // This way of setting LD_PRELOAD does not work with Android test runner.
9 // REQUIRES: !android
11 #include <stdlib.h>
13 extern "C" ssize_t write(int fd, const void *buf, size_t count);
15 void do_access(void *p) {
16 // CHECK: AddressSanitizer: heap-buffer-overflow
17 write(1, p, 2);
20 int main(int argc, char **argv) {
21 void *p = malloc(1);
22 do_access(p);
23 return 0;