mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
32 lines
490 B
Plaintext
32 lines
490 B
Plaintext
module test;
|
|
|
|
union UnionB
|
|
{
|
|
struct b
|
|
{
|
|
int a;
|
|
}
|
|
int c;
|
|
double d;
|
|
}
|
|
|
|
extern func int bar();
|
|
|
|
func void test()
|
|
{
|
|
UnionB b = { .c = bar(), .b = {} };
|
|
}
|
|
|
|
// #expect: test.ll
|
|
|
|
entry:
|
|
%b = alloca %test.UnionB, align 8
|
|
%0 = bitcast %test.UnionB* %b to i32*
|
|
%1 = call i32 @bar()
|
|
store i32 %1, i32* %0, align 4
|
|
%2 = bitcast %test.UnionB* %b to %test.b*
|
|
%3 = bitcast %test.b* %2 to i8*
|
|
call void @llvm.memset.p0i8.i64(i8* align 4 %3, i8 0, i64 4, i1 false)
|
|
ret void
|
|
|