mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std;
|
|
// Issue #1913
|
|
fn void main()
|
|
{
|
|
char[] bytes = file::load_temp("config.json") ?? abort("Unable to open config.json file");
|
|
int hello;
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
define void @test.main() #0 {
|
|
entry:
|
|
%bytes = alloca %"char[]", align 8
|
|
%retparam = alloca %"char[]", align 8
|
|
%blockret = alloca %"char[]", align 8
|
|
%indirectarg = alloca %"any[]", align 8
|
|
%hello = alloca i32, align 4
|
|
%0 = call i64 @std.io.file.load_temp(ptr %retparam, ptr @.str, i64 11)
|
|
%not_err = icmp eq i64 %0, 0
|
|
%1 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
|
|
br i1 %1, label %after_check, label %else_block
|
|
|
|
after_check: ; preds = %entry
|
|
%2 = load %"char[]", ptr %retparam, align 8
|
|
br label %phi_block
|
|
|
|
else_block: ; preds = %entry
|
|
store %"any[]" zeroinitializer, ptr %indirectarg, align 8
|
|
call void @std.core.builtin.panicf(ptr @.str.1, i64 31, ptr @.str.2, i64 19, ptr @.str.3, i64 4, i32 6, ptr byval(%"any[]") align 8 %indirectarg)
|
|
call void @llvm.trap()
|
|
unreachable
|
|
|
|
phi_block: ; preds = %after_check
|
|
store %"char[]" %2, ptr %bytes, align 8
|
|
store i32 0, ptr %hello, align 4
|
|
ret void
|
|
}
|