aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2025-01-15 20:14:23 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2025-01-15 20:18:50 +0100
commitaa3f0b86c143802d9e81122698e38361751c7a68 (patch)
treeca7ad0388c3799dfde397cabd9ed2f151a686f6a /src/check_type.cpp
parente55b65291685c8a1fc3d70252a73f01c7c6f253c (diff)
compiler: fix align error check
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 44108ccbe..4d9101c6c 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -685,7 +685,8 @@ gb_internal void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *
ST_ALIGN(min_field_align);
ST_ALIGN(max_field_align);
ST_ALIGN(align);
- if (struct_type->Struct.custom_align < struct_type->Struct.custom_min_field_align) {
+ if (struct_type->Struct.custom_align != 0 &&
+ struct_type->Struct.custom_align < struct_type->Struct.custom_min_field_align) {
error(st->align, "#align(%lld) is defined to be less than #min_field_align(%lld)",
cast(long long)struct_type->Struct.custom_align,
cast(long long)struct_type->Struct.custom_min_field_align);