xref: /llvm-project/compiler-rt/test/scudo/fsanitize.c (revision f7c5c0d87b8ae5e55006fd3a31994cd68d64f102)
1*f7c5c0d8SMitch Phillips // Test various -fsanitize= additional flags combinations.
2*f7c5c0d8SMitch Phillips 
3*f7c5c0d8SMitch Phillips // RUN: %clang_scudo %s -o %t
4*f7c5c0d8SMitch Phillips // RUN: not %run %t 2>&1 | FileCheck %s
5*f7c5c0d8SMitch Phillips 
6*f7c5c0d8SMitch Phillips // RUN: %clang_scudo -shared-libsan %s -o %t
7*f7c5c0d8SMitch Phillips // RUN: env LD_LIBRARY_PATH=`dirname %shared_libscudo`:$LD_LIBRARY_PATH not %run %t 2>&1 | FileCheck %s
8*f7c5c0d8SMitch Phillips // RUN: %clang_scudo -shared-libsan -fsanitize-minimal-runtime %s -o %t
9*f7c5c0d8SMitch Phillips // RUN: env LD_LIBRARY_PATH=`dirname %shared_minlibscudo`:$LD_LIBRARY_PATH not %run %t 2>&1 | FileCheck %s
10*f7c5c0d8SMitch Phillips 
11*f7c5c0d8SMitch Phillips // RUN: %clang_scudo -static-libsan %s -o %t
12*f7c5c0d8SMitch Phillips // RUN: not %run %t 2>&1 | FileCheck %s
13*f7c5c0d8SMitch Phillips // RUN: %clang_scudo -static-libsan -fsanitize-minimal-runtime %s -o %t
14*f7c5c0d8SMitch Phillips // RUN: not %run %t 2>&1 | FileCheck %s
15*f7c5c0d8SMitch Phillips 
16*f7c5c0d8SMitch Phillips #include <assert.h>
17*f7c5c0d8SMitch Phillips #include <stdlib.h>
18*f7c5c0d8SMitch Phillips 
main(int argc,char * argv[])19*f7c5c0d8SMitch Phillips int main(int argc, char *argv[]) {
20*f7c5c0d8SMitch Phillips   unsigned long *p = (unsigned long *)malloc(sizeof(unsigned long));
21*f7c5c0d8SMitch Phillips   assert(p);
22*f7c5c0d8SMitch Phillips   *p = 0;
23*f7c5c0d8SMitch Phillips   free(p);
24*f7c5c0d8SMitch Phillips   free(p);
25*f7c5c0d8SMitch Phillips   return 0;
26*f7c5c0d8SMitch Phillips }
27*f7c5c0d8SMitch Phillips 
28*f7c5c0d8SMitch Phillips // CHECK: ERROR: invalid chunk state
29