[clang] [UBSAN] add null, alignment and array-bounds checks (PR #190739)
Tony Varghese via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 07:04:07 PDT 2026
================
@@ -38,15 +37,17 @@ __attribute__((noinline)) void test_init_plain_arr_idx(struct Small arr[4]) {
// SHARED-LABEL: define {{[^@]*}}@test_init_list_plain_arr_idx
// SHARED: [[ARR:%.*]] = load ptr, ptr %arr.addr
// SHARED: [[SRC:%.*]] = getelementptr inbounds %struct.Small, ptr [[ARR]], i64 0
-// SHARED-NOT: call void @__ubsan_handle_type_mismatch_v1_abort
-// SHARED-NOT: icmp ne ptr [[SRC]], null
+// SHARED: icmp ne ptr [[SRC]], null
+// SHARED: call void @__ubsan_handle_type_mismatch_v1_abort(
// SHARED: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %{{.*}}, ptr align 4 [[SRC]], i64 4, i1 false)
__attribute__((noinline)) void test_init_list_plain_arr_idx(struct Small arr[4]) {
struct Small a[] = {arr[0]};
}
+// Two ubsan calls: one for destination (c), one for source (arr[0])
// SHARED-LABEL: define {{[^@]*}}@test_nested_member_plain_arr_idx
-// SHARED: call void @__ubsan_handle_type_mismatch_v1_abort
+// SHARED: call void @__ubsan_handle_type_mismatch_v1_abort(
+// SHARED: call void @__ubsan_handle_type_mismatch_v1_abort(
----------------
tonykuttai wrote:
Maybe you can more IR lines to capture that `src` and `dest` are being tested.
https://github.com/llvm/llvm-project/pull/190739
More information about the cfe-commits
mailing list