CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
62 lines
2.4 KiB
C++
62 lines
2.4 KiB
C++
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefixes=CHECK,NULL --implicit-check-not=ubsantrap %s
|
|
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
|
|
|
|
// With -fextend-variable-liveness, the compiler previously generated a fake.use of any
|
|
// reference variable at the end of the scope in which its alloca exists. This
|
|
// caused two issues, where we would get fake uses for uninitialized variables
|
|
// if that variable was declared after an early-return, and UBSan's null checks
|
|
// would complain about this.
|
|
// This test verifies that UBSan does not produce null-checks for arguments to
|
|
// llvm.fake.use, and that fake uses are not emitted for a variable on paths
|
|
// it has not been declared.
|
|
|
|
struct A { short s1, s2; };
|
|
extern long& getA();
|
|
|
|
void foo()
|
|
{
|
|
auto& va = getA();
|
|
if (va < 5)
|
|
return;
|
|
|
|
auto& vb = getA();
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}}foo
|
|
// CHECK: [[VA_CALL:%.+]] = call{{.*}} ptr @_Z4getAv()
|
|
|
|
/// We check here for the first UBSan check for "va".
|
|
// NULL: [[VA_ISNULL:%.+]] = icmp ne ptr [[VA_CALL]], null
|
|
// NULL: br i1 [[VA_ISNULL]], label %{{[^,]+}}, label %[[VA_TRAP:[^,]+]]
|
|
// NULL: [[VA_TRAP]]:
|
|
// NULL: call void @llvm.ubsantrap(
|
|
|
|
// CHECK: [[VA_PTR:%.+]] = load ptr, ptr %va
|
|
// CHECK-NEXT: [[VA_CMP:%.+]] = load i64, ptr [[VA_PTR]]
|
|
// CHECK-NEXT: [[VA_CMP_RES:%.+]] = icmp slt i64 [[VA_CMP]], 5
|
|
// CHECK-NEXT: br i1 [[VA_CMP_RES]], label %[[EARLY_EXIT:[^,]+]], label %[[NOT_EARLY_EXIT:[^,]+]]
|
|
|
|
// CHECK: [[EARLY_EXIT]]:
|
|
// CHECK: br label %cleanup
|
|
|
|
/// The fake use for "vb" only appears on the path where its declaration is
|
|
/// reached.
|
|
// CHECK: [[NOT_EARLY_EXIT]]:
|
|
// CHECK: [[VB_CALL:%.+]] = call{{.*}} ptr @_Z4getAv()
|
|
|
|
/// We check here for the second UBSan check for "vb".
|
|
// NULL: [[VB_ISNULL:%.+]] = icmp ne ptr [[VB_CALL]], null
|
|
// NULL: br i1 [[VB_ISNULL]], label %{{[^,]+}}, label %[[VB_TRAP:[^,]+]]
|
|
// NULL: [[VB_TRAP]]:
|
|
// NULL: call void @llvm.ubsantrap(
|
|
|
|
// CHECK: [[VB_FAKE_USE:%.+]] = load ptr, ptr %vb
|
|
// CHECK-NEXT: call void (...) @llvm.fake.use(ptr [[VB_FAKE_USE]])
|
|
// CHECK: br label %cleanup
|
|
|
|
// CHECK: cleanup:
|
|
// CHECK: [[VA_FAKE_USE:%.+]] = load ptr, ptr %va
|
|
// CHECK-NEXT: call void (...) @llvm.fake.use(ptr [[VA_FAKE_USE]])
|
|
|
|
// NULL: declare void @llvm.ubsantrap
|