1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -w -emit-llvm -o - %s -fsanitize=pointer-overflow | FileCheck %s 2 3// CHECK-LABEL: define{{.*}} void @variable_len_array_arith 4void variable_len_array_arith(int n, int k) { 5 int vla[n]; 6 int (*p)[n] = &vla; 7 8 // CHECK: getelementptr inbounds i32, i32* {{.*}}, i64 [[INC:%.*]] 9 // CHECK: @llvm.smul.with.overflow.i64(i64 4, i64 [[INC]]), !nosanitize 10 // CHECK-NOT: select 11 // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} 12 ++p; 13 14 // CHECK: getelementptr inbounds i32, i32* {{.*}}, i64 [[IDXPROM:%.*]] 15 // CHECK: @llvm.smul.with.overflow.i64(i64 4, i64 [[IDXPROM]]), !nosanitize 16 // CHECK: select 17 // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} 18 p + k; 19} 20 21// CHECK-LABEL: define{{.*}} void @objc_id 22void objc_id(id *p) { 23 // CHECK: add i64 {{.*}}, 8, !nosanitize 24 // CHECK-NOT: select 25 // CHECK: @__ubsan_handle_pointer_overflow{{.*}} 26 p++; 27} 28