1// Test that the preloaded runtime works without linking the static library.
2
3// RUN: %clang %s -lstdc++ -o %t
4// RUN: env LD_PRELOAD=%shared_libscudo not %run %t 2>&1 | FileCheck %s
5// RUN: env LD_PRELOAD=%shared_minlibscudo not %run %t 2>&1 | FileCheck %s
6
7// This way of setting LD_PRELOAD does not work with Android test runner.
8// REQUIRES: !android
9
10#include <assert.h>
11
12int main(int argc, char *argv[]) {
13 int *p = new int;
14 assert(p);
15 *p = 0;
16 delete p;
17 delete p;
18 return 0;
19}
20
21// CHECK: ERROR: invalid chunk state
22

source code of compiler-rt/test/scudo/preload.cpp