brintos

brintos / llvm-project-archived public Read only

0
0
Text · 744 B · c2ebdf3 Raw
27 lines · cpp
1// RUN: %clangxx -fsanitize=realtime %s -o %t2// RUN: %env_rtsan_opts="halt_on_error=true" not %run %t 2>&1 | FileCheck %s3// RUN: %env_rtsan_opts="halt_on_error=false" %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-HALT,CHECK4// UNSUPPORTED: ios5 6// Intent: Ensure that halt_on_error does not exit on the first violation.7 8#include <stdlib.h>9 10void *MallocViolation() { return malloc(10); }11 12void FreeViolation(void *Ptr) { free(Ptr); }13 14void process() [[clang::nonblocking]] {15  void *Ptr = MallocViolation();16  FreeViolation(Ptr);17}18 19int main() {20  process();21  return 0;22  // CHECK: ==ERROR: RealtimeSanitizer23  // CHECK-NEXT: {{.*`malloc`.*}}24  // CHECK-NO-HALT: ==ERROR: RealtimeSanitizer25  // CHECK-NO-HALT-NEXT: {{.*`free`.*}}26}27