brintos

brintos / llvm-project-archived public Read only

0
0
Text · 696 B · bdca603 Raw
29 lines · c
1// RUN: %clang -fsanitize=realtime %s -o %t2// RUN: not %run %t 2>&1 | FileCheck %s3// RUN: %clang %s -o %t4// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE5#ifdef __cplusplus6#  error "This test must be built in C mode"7#endif8 9#include <stdio.h>10#include <stdlib.h>11 12// Check that we can build and run C code.13 14void nonblocking_function(void) __attribute__((nonblocking));15 16void nonblocking_function(void) __attribute__((nonblocking)) {17  void *ptr = malloc(2);18  printf("ptr: %p\n", ptr); // ensure we don't optimize out the malloc19}20 21int main() {22  nonblocking_function();23  printf("Done\n");24  return 0;25}26 27// CHECK: ==ERROR: RealtimeSanitizer28// CHECK-NO-SANITIZE: Done29