Fix incorrect padding in arrays of structs (Issue #5484) (#5491)

This commit is contained in:
svenk177
2019-08-23 19:46:47 +02:00
committed by Wouter van Oortmerssen
parent b97b342f59
commit 4525c91be3
16 changed files with 228 additions and 57 deletions

View File

@@ -367,9 +367,14 @@ inline size_t InlineSize(const Type &type) {
}
inline size_t InlineAlignment(const Type &type) {
return IsStruct(type)
? type.struct_def->minalign
: (SizeOf(IsArray(type) ? type.element : type.base_type));
if (IsStruct(type)) {
return type.struct_def->minalign;
} else if (IsArray(type)) {
return IsStruct(type.VectorType()) ? type.struct_def->minalign
: SizeOf(type.element);
} else {
return SizeOf(type.base_type);
}
}
struct EnumDef;