Files
c3c/test/test_suite14/arrays/array_casts.c3t
2023-01-11 18:00:08 +01:00

34 lines
873 B
C

// #target: macos-x64
module array_casts;
fn void test()
{
int[3] x;
int *y = &x;
int[] z = &x;
}
// #expect: array_casts.ll
%"int[]" = type { i32*, i64 }
define void @array_casts_test() #0 {
entry:
%x = alloca [3 x i32], align 4
%y = alloca i32*, align 8
%z = alloca %"int[]", align 8
%0 = getelementptr inbounds [3 x i32], [3 x i32]* %x, i64 0, i64 0
store i32 0, i32* %0, align 4
%1 = getelementptr inbounds [3 x i32], [3 x i32]* %x, i64 0, i64 1
store i32 0, i32* %1, align 4
%2 = getelementptr inbounds [3 x i32], [3 x i32]* %x, i64 0, i64 2
store i32 0, i32* %2, align 4
%ptrptr = bitcast [3 x i32]* %x to i32*
store i32* %ptrptr, i32** %y, align 8
%3 = bitcast [3 x i32]* %x to i32*
%4 = insertvalue %"int[]" undef, i32* %3, 0
%5 = insertvalue %"int[]" %4, i64 3, 1
store %"int[]" %5, %"int[]"* %z, align 8
ret void
}