Files
c3c/test/test_suite/strings/literal_to_subarray.c3t
2021-11-16 17:46:44 +01:00

23 lines
654 B
C

// #target: x64-darwin
global char[] y = "hello";
fn void test()
{
char[] x = "world";
}
// #expect: literal_to_subarray.ll
%"char[]" = type { i8*, i64 }
@.str = private constant [6 x i8] c"hello\00", align 1
@literal_to_subarray.y = global %"char[]" { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 5 }, align 8
@.str.1 = private constant [6 x i8] c"world\00", align 1
; Function Attrs: nounwind
define void @literal_to_subarray.test() #0 {
entry:
%x = alloca %"char[]", align 8
store %"char[]" { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i64 5 }, %"char[]"* %x, align 8
ret void
}