mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Upgrade of mingw in CI. Fix problems using reflection on interface types #1203. Improved debug information on defer. $foreach doesn't create an implicit syntactic scope. Error if `@if` depends on `@if`. Updated Linux stacktrace. Fix of default argument stacktrace. Allow linking libraries directly by file path. Improve inlining warning messages. Added `index_of_char_from`. Compiler crash using enum nameof from different module #1205. Removed unused fields in find_msvc. Use vswhere to find msvc. Update tests for LLVM 19
61 lines
1.9 KiB
C
61 lines
1.9 KiB
C
// #target: macos-x64
|
|
// #safe: yes
|
|
module main;
|
|
|
|
fn void! main()
|
|
{
|
|
for (usz i = 0; i < 100000000; i++)
|
|
{
|
|
assert(i != 2, "Test %s %s", i, i * 2);
|
|
}
|
|
}
|
|
|
|
/* #expect: main.ll
|
|
|
|
define i64 @main.main() #0 {
|
|
entry:
|
|
%i = alloca i64, align 8
|
|
%taddr = alloca i64, align 8
|
|
%varargslots = alloca [2 x %any], align 16
|
|
%indirectarg = alloca %"any[]", align 8
|
|
store i64 0, ptr %i, align 8
|
|
br label %loop.cond
|
|
|
|
loop.cond: ; preds = %assert_ok, %entry
|
|
%0 = load i64, ptr %i, align 8
|
|
%gt = icmp ugt i64 100000000, %0
|
|
br i1 %gt, label %loop.body, label %loop.exit
|
|
|
|
loop.body: ; preds = %loop.cond
|
|
%1 = load i64, ptr %i, align 8
|
|
%neq = icmp ne i64 2, %1
|
|
br i1 %neq, label %assert_ok, label %assert_fail
|
|
|
|
assert_fail: ; preds = %loop.body
|
|
%2 = insertvalue %any undef, ptr %i, 0
|
|
%3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1
|
|
%4 = load i64, ptr %i, align 8
|
|
%mul = mul i64 %4, 2
|
|
store i64 %mul, ptr %taddr, align 8
|
|
%5 = insertvalue %any undef, ptr %taddr, 0
|
|
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.long" to i64), 1
|
|
store %any %3, ptr %varargslots, align 16
|
|
%ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16
|
|
store %any %6, ptr %ptradd, align 16
|
|
%7 = insertvalue %"any[]" undef, ptr %varargslots, 0
|
|
%"$$temp" = insertvalue %"any[]" %7, i64 2, 1
|
|
store %"any[]" %"$$temp", ptr %indirectarg, align 8
|
|
call void @std.core.builtin.panicf(ptr @.panic_msg, i64 10, ptr @.file, i64 10, ptr @.func, i64 4, i32 7, ptr byval(%"any[]") align 8 %indirectarg)
|
|
unreachable
|
|
|
|
assert_ok: ; preds = %loop.body
|
|
%8 = load i64, ptr %i, align 8
|
|
%add = add i64 %8, 1
|
|
store i64 %add, ptr %i, align 8
|
|
br label %loop.cond
|
|
|
|
loop.exit: ; preds = %loop.cond
|
|
ret i64 0
|
|
}
|
|
|