Skip to content

Commit ec1024d

Browse files
committed
fix UB in testcase
1 parent 702d9dd commit ec1024d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/test/CodeGen/array-bounds-constraints-safety.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ int test_extern_array(int i) {
6969
}
7070

7171
// CHECK-LABEL: define {{.*}} @test_local_constant_array
72+
void init_array(int *arr);
7273
int test_local_constant_array(int i) {
7374
int arr[10];
75+
init_array(arr); // Initialize to avoid UB from uninitialized read.
7476
// CHECK: call void @llvm.assume
7577
// This will generate bounds constraints.
7678
// We know the exact size of this alloca array.

0 commit comments

Comments
 (0)