| 1 | // RUN: %clang -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK |
|---|---|
| 2 | |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | int main(int argc, char *argv[]) { |
| 6 | |
| 7 | char *ptr = (char *)malloc(size: 2); |
| 8 | |
| 9 | void *t = __builtin_assume_aligned(ptr + 1, 0x8000); |
| 10 | (void)t; |
| 11 | // CHECK: ubsan: alignment-assumption by 0x{{[[:xdigit:]]+$}} |
| 12 | // CHECK-NOT: alignment-assumption |
| 13 | |
| 14 | free(ptr: ptr); |
| 15 | |
| 16 | return 0; |
| 17 | } |
| 18 |
