1 // RUN: %clangxx %s -fsanitize-memory-track-origins=1 -o %t 2 // RUN: %env_tool_opts="compress_stack_depot=0:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --implicit-check-not="StackDepot released" 3 // RUN: %env_tool_opts="compress_stack_depot=1:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --check-prefixes=COMPRESS 4 5 // Ubsan does not store stacks. 6 // UNSUPPORTED: ubsan 7 8 // FIXME: Fails for unknown reason. 9 // UNSUPPORTED: s390x 10 11 #include <memory> 12 13 __attribute__((noinline)) void a(unsigned v); 14 __attribute__((noinline)) void b(unsigned v); 15 16 std::unique_ptr<int[]> p; 17 18 __attribute__((noinline)) void a(unsigned v) { 19 int x; 20 v >>= 1; 21 if (!v) { 22 p.reset(new int[100]); 23 p[1] = x; 24 return; 25 } 26 if (v & 1) 27 b(v); 28 else 29 a(v); 30 } 31 32 __attribute__((noinline)) void b(unsigned v) { return a(v); } 33 34 int main(int argc, char *argv[]) { 35 for (unsigned i = 0; i < 100000; ++i) 36 a(i + (i << 16)); 37 return 0; 38 } 39 40 // COMPRESS: StackDepot released {{[0-9]+}} 41