mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix packed gep loads with wrong alignment
This commit is contained in:
@@ -135,6 +135,8 @@ gb_internal void check_struct_fields(CheckerContext *ctx, Ast *node, Slice<Entit
|
|||||||
if (is_type_polymorphic(type)) {
|
if (is_type_polymorphic(type)) {
|
||||||
struct_type->Struct.is_polymorphic = true;
|
struct_type->Struct.is_polymorphic = true;
|
||||||
type = nullptr;
|
type = nullptr;
|
||||||
|
} else if(struct_type->Struct.is_packed) {
|
||||||
|
type->flags |= TypeFlag_Packed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == nullptr) {
|
if (type == nullptr) {
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ enum TypeFlag : u32 {
|
|||||||
TypeFlag_Polymorphic = 1<<1,
|
TypeFlag_Polymorphic = 1<<1,
|
||||||
TypeFlag_PolySpecialized = 1<<2,
|
TypeFlag_PolySpecialized = 1<<2,
|
||||||
TypeFlag_InProcessOfCheckingPolymorphic = 1<<3,
|
TypeFlag_InProcessOfCheckingPolymorphic = 1<<3,
|
||||||
|
TypeFlag_Packed = 1<<4,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Type {
|
struct Type {
|
||||||
@@ -3671,6 +3672,9 @@ gb_internal i64 type_align_of(Type *t) {
|
|||||||
if (t == nullptr) {
|
if (t == nullptr) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (t->flags & TypeFlag_Packed) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (t->kind != Type_Named && t->cached_align > 0) {
|
if (t->kind != Type_Named && t->cached_align > 0) {
|
||||||
return t->cached_align.load();
|
return t->cached_align.load();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user