[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / catch-nullptr-and-nonzero-offset-ignorelist.c
blob4150b58462bf02079175fc0cca8f1b5a8153a33d
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"
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"
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 // CHECK-LABEL: @baseline
12 char *baseline(char *base, unsigned long offset) {
13 // CHECK: call void @__ubsan_handle_pointer_overflow(
14 return base + offset;
17 // CHECK-LABEL: @ignorelist_0
18 __attribute__((no_sanitize("undefined"))) char *ignorelist_0(char *base, unsigned long offset) {
19 return base + offset;
22 // CHECK-LABEL: @ignorelist_1
23 __attribute__((no_sanitize("pointer-overflow"))) char *ignorelist_1(char *base, unsigned long offset) {
24 return base + offset;
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;
32 #ifdef __cplusplus
34 #endif