1 // RUN: %clangxx -fsanitize=alignment %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
3 // RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
4 // REQUIRES: !ubsan-standalone && !ubsan-standalone-static
5 
6 #include <stdlib.h>
7 
main(int argc,char * argv[])8 int main(int argc, char* argv[]) {
9   char *ptr = (char *)malloc(2);
10 
11   __builtin_assume_aligned(ptr + 1, 0x8000);
12   // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:32
13   // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: alignment-assumption {{.*}}summary.cpp:[[@LINE-2]]:32
14   free(ptr);
15 
16   return 0;
17 }
18