]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/asan/TestCases/Linux/asan_rt_confict_test-2.cc
Vendor import of compiler-rt trunk r256633:
[FreeBSD/FreeBSD.git] / test / asan / TestCases / Linux / asan_rt_confict_test-2.cc
1 // Test that mixed static/dynamic sanitization of program objects
2 // is prohibited.
3 //
4 // RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t.so
5 // RUN: %clangxx_asan_static %s %t.so -o %t
6 // RUN: not %run %t 2>&1 | FileCheck %s
7
8 // REQUIRES: asan-dynamic-runtime
9 // XFAIL: android
10
11 #if BUILD_SO
12 char dummy;
13 void do_access(const void *p) { dummy = ((const char *)p)[1]; }
14 #else
15 #include <stdlib.h>
16 extern void do_access(const void *p);
17 int main(int argc, char **argv) {
18   void *p = malloc(1);
19   do_access(p);
20   free(p);
21   return 0;
22 }
23 #endif
24
25 // CHECK: Your application is linked against incompatible ASan runtimes