brintos

brintos / llvm-project-archived public Read only

0
0
Text · 589 B · 4ea80b3 Raw
17 lines · cpp
1// RUN: %clangxx -fsanitize=alignment %s -o %t2// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE3// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE4 5#include <stdlib.h>6 7int main(int argc, char* argv[]) {8  char *ptr = (char *)malloc(2);9 10  __builtin_assume_aligned(ptr + 1, 0x8000);11  // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:3212  // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: alignment-assumption {{.*}}summary.cpp:[[@LINE-2]]:3213  free(ptr);14 15  return 0;16}17