mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Wrong size for structs containing overaligned structs #1219
This commit is contained in:
43
test/test_suite/struct/struct_union_inner_align.c3t
Normal file
43
test/test_suite/struct/struct_union_inner_align.c3t
Normal file
@@ -0,0 +1,43 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
|
||||
union Test @align(16)
|
||||
{
|
||||
char foo;
|
||||
}
|
||||
|
||||
union Test3
|
||||
{
|
||||
Test test;
|
||||
ulong a @align(32);
|
||||
}
|
||||
|
||||
struct Test2
|
||||
{
|
||||
Test test;
|
||||
uint a;
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Test2 a;
|
||||
Test b;
|
||||
Test3 c;
|
||||
$assert(32 == Test3.sizeof);
|
||||
$assert(32 == Test3.alignof);
|
||||
$assert(32 == Test2.sizeof);
|
||||
$assert(16 == Test2.alignof);
|
||||
$assert(16 == Test.sizeof);
|
||||
$assert(16 == Test.alignof);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
%Test2 = type { %Test, i32, [12 x i8] }
|
||||
%Test = type { i8, [15 x i8] }
|
||||
%Test3 = type { i64, [24 x i8] }
|
||||
|
||||
%a = alloca %Test2, align 16
|
||||
%b = alloca %Test, align 16
|
||||
%c = alloca %Test3, align 32
|
||||
Reference in New Issue
Block a user