mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Incorrect codegen if a macro ends with unreachable and is assigned to something. #2210
This commit is contained in:
37
test/test_suite/assert/unreachable_in_assign.c3t
Normal file
37
test/test_suite/assert/unreachable_in_assign.c3t
Normal file
@@ -0,0 +1,37 @@
|
||||
// #target: windows-x64
|
||||
module test;
|
||||
|
||||
macro int create_int2() {
|
||||
$$unreachable();
|
||||
}
|
||||
|
||||
fn void test()
|
||||
{
|
||||
int x = create_int2();
|
||||
}
|
||||
macro int? create_int()
|
||||
{
|
||||
$$unreachable();
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
int? x = create_int();
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define void @test.test() #0 {
|
||||
entry:
|
||||
%x = alloca i32, align 4
|
||||
%blockret = alloca i32, align 4
|
||||
unreachable
|
||||
}
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%x = alloca i32, align 4
|
||||
%x.f = alloca i64, align 8
|
||||
%blockret = alloca i32, align 4
|
||||
unreachable
|
||||
}
|
||||
Reference in New Issue
Block a user