diff options
Diffstat (limited to 'test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp')
-rw-r--r-- | test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp new file mode 100644 index 000000000000..cc7769a06fe5 --- /dev/null +++ b/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp @@ -0,0 +1,17 @@ +// RUN: %clangxx -fsanitize=alignment %s -o %t +// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE +// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE +// REQUIRES: !ubsan-standalone && !ubsan-standalone-static + +#include <stdlib.h> + +int main(int argc, char* argv[]) { + char *ptr = (char *)malloc(2); + + __builtin_assume_aligned(ptr + 1, 0x8000); + // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:32 + // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: alignment-assumption {{.*}}summary.cpp:[[@LINE-2]]:32 + free(ptr); + + return 0; +} |