[clang-format] Handle C-style cast of member function pointer type (#126340)
[llvm-project.git] / compiler-rt / test / rtsan / sanity_check_pure_c.c
blobbdca6039d9324d380ffbc67605aa7e0076145bad
1 // RUN: %clang -fsanitize=realtime %s -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 // RUN: %clang %s -o %t
4 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE
5 #ifdef __cplusplus
6 # error "This test must be built in C mode"
7 #endif
9 #include <stdio.h>
10 #include <stdlib.h>
12 // Check that we can build and run C code.
14 void nonblocking_function(void) __attribute__((nonblocking));
16 void nonblocking_function(void) __attribute__((nonblocking)) {
17 void *ptr = malloc(2);
18 printf("ptr: %p\n", ptr); // ensure we don't optimize out the malloc
21 int main() {
22 nonblocking_function();
23 printf("Done\n");
24 return 0;
27 // CHECK: ==ERROR: RealtimeSanitizer
28 // CHECK-NO-SANITIZE: Done