| 1 |
// RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" |
| 2 |
// RUN: %clang_cc1 -x c -fno-delete-null-pointer-checks -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" |
| 5 |
// RUN: %clang_cc1 -x c++ -fno-delete-null-pointer-checks -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" |
| 6 |
|
| 7 |
#ifdef __cplusplus |
| 8 |
extern "C" { |
| 9 |
#endif |
| 10 |
|
| 11 |
// CHECK-LABEL: @baseline |
| 12 |
char *baseline(char *base, unsigned long offset) { |
| 13 |
// CHECK: call void @__ubsan_handle_pointer_overflow( |
| 14 |
return base + offset; |
| 15 |
} |
| 16 |
|
| 17 |
// CHECK-LABEL: @ignorelist_0 |
| 18 |
__attribute__((no_sanitize("undefined"))) char *ignorelist_0(char *base, unsigned long offset) { |
| 19 |
return base + offset; |
| 20 |
} |
| 21 |
|
| 22 |
// CHECK-LABEL: @ignorelist_1 |
| 23 |
__attribute__((no_sanitize("pointer-overflow"))) char *ignorelist_1(char *base, unsigned long offset) { |
| 24 |
return base + offset; |
| 25 |
} |
| 26 |
|
| 27 |
// CHECK-LABEL: @ignore_non_default_address_space |
| 28 |
__attribute__((address_space(1))) char *ignore_non_default_address_space(__attribute__((address_space(1))) char *base, unsigned long offset) { |
| 29 |
return base + offset; |
| 30 |
} |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
} |
| 34 |
#endif |