mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
31 lines
685 B
C
31 lines
685 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 { ptr, i64 }
|
|
|
|
define void @array_casts.test() #0 {
|
|
entry:
|
|
%x = alloca [3 x i32], align 4
|
|
%y = alloca ptr, align 8
|
|
%z = alloca %"int[]", align 8
|
|
store i32 0, ptr %x, align 4
|
|
%ptradd = getelementptr inbounds i8, ptr %x, i64 4
|
|
store i32 0, ptr %ptradd, align 4
|
|
%ptradd1 = getelementptr inbounds i8, ptr %x, i64 8
|
|
store i32 0, ptr %ptradd1, align 4
|
|
store ptr %x, ptr %y, align 8
|
|
%0 = insertvalue %"int[]" undef, ptr %x, 0
|
|
%1 = insertvalue %"int[]" %0, i64 3, 1
|
|
store %"int[]" %1, ptr %z, align 8
|
|
ret void
|
|
}
|