mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Member access on a struct returned by the assignment expression, cause crash #2947
This commit is contained in:
28
test/test_suite/expressions/assign_from_call_to_struct.c3t
Normal file
28
test/test_suite/expressions/assign_from_call_to_struct.c3t
Normal file
@@ -0,0 +1,28 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
struct Test
|
||||
{
|
||||
long a;
|
||||
long b;
|
||||
char c;
|
||||
}
|
||||
|
||||
fn Test f() => {};
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Test t;
|
||||
(t = f()).b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%t = alloca %Test, align 8
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %t, i8 0, i64 24, i1 false)
|
||||
call void @test.f(ptr sret(%Test) align 8 %t)
|
||||
%ptradd = getelementptr inbounds i8, ptr %t, i64 8
|
||||
ret i32 0
|
||||
}
|
||||
Reference in New Issue
Block a user