brintos

brintos / llvm-project-archived public Read only

0
0
Text · 724 B · 69edc63 Raw
27 lines · cpp
1// RUN: %clangxx %s -o %t2// RUN: %run %t 2>&1 | FileCheck %s3// UNSUPPORTED: ios4 5// Intent: Ensure [[clang::nonblocking]] has no impact if -fsanitize=realtime is not used6 7#include <stdio.h>8#include <stdlib.h>9 10// In this test, we don't use the -fsanitize=realtime flag, so nothing11// should happen here12void violation() [[clang::nonblocking]] {13  void *ptr = malloc(2);14  printf("ptr: %p\n", ptr); // ensure we don't optimize out the malloc15}16 17int main() {18  printf("Starting run\n");19  violation();20  printf("No violations ended the program\n");21  return 0;22  // CHECK: {{.*Starting run.*}}23  // CHECK NOT: {{.*Real-time violation.*}}24  // CHECK NOT: {{.*malloc*}}25  // CHECK: {{.*No violations ended the program.*}}26}27