brintos

brintos / llvm-project-archived public Read only

0
0
Text · 784 B · 29a63c0 Raw
31 lines · cpp
1// Tests -fsanitize-coverage=stack-depth2//3// RUN: %clangxx -O0 -std=c++11 -fsanitize-coverage=stack-depth %s -o %t4// RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not Assertion{{.*}}failed5// RUN: %clangxx -O0 -std=c++11 -fsanitize-coverage=trace-pc-guard,stack-depth \6// RUN:     %s -o %t7// RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not Assertion{{.*}}failed8 9#include <cstdint>10#include <cstdio>11#include <cassert>12 13thread_local uintptr_t __sancov_lowest_stack;14uintptr_t last_stack;15 16void foo(int recurse) {17  assert(__sancov_lowest_stack < last_stack);18  last_stack = __sancov_lowest_stack;19  if (recurse <= 0) return;20  foo(recurse - 1);21}22 23int main() {24  last_stack = __sancov_lowest_stack;25  foo(100);26  printf("Success!\n");27  return 0;28}29 30// CHECK: Success!31