projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c99fb43
)
bugfix: tagged unions alignment not always respected
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 22 Jun 2023 23:28:03 +0000
(18:28 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 22 Jun 2023 23:28:03 +0000
(18:28 -0500)
compiler/src/types.c
patch
|
blob
|
history
diff --git
a/compiler/src/types.c
b/compiler/src/types.c
index 073da57a66dae458d239234de4bf9a3d21e33b34..29c955a9091d7ad5fdf85561e51c677473fde157 100644
(file)
--- a/
compiler/src/types.c
+++ b/
compiler/src/types.c
@@
-805,6
+805,9
@@
static Type* type_build_from_ast_inner(bh_allocator alloc, AstType* type_node, b
bh_arr_push(tag_enum_node->values, ev);
}
+ alignment = bh_max(alignment, 4);
+ bh_align(size, alignment);
+
u_type->Union.alignment = alignment;
u_type->Union.size = size + alignment; // Add the size of the tag
u_type->Union.tag_type = type_build_from_ast(alloc, (AstType *) tag_enum_node);