fully specify padding bytes when necessary

This is what I was going for originally - either we understand that
LLVM's padding is sufficient, or we do the entire padding ourselves.
This commit is contained in:
Andrew Kelley 2019-09-27 15:53:30 -04:00
parent 67bd0267db
commit 09575bc0d6
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -7839,7 +7839,7 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS
assert(next_offset >= llvm_next_offset);
if (next_offset > llvm_next_offset) {
size_t pad_bytes = next_offset - llvm_next_offset;
size_t pad_bytes = next_offset - (field->offset + LLVMStoreSizeOfType(g->target_data_ref, llvm_type));
if (pad_bytes != 0) {
LLVMTypeRef pad_llvm_type = LLVMArrayType(LLVMInt8Type(), pad_bytes);
element_types[gen_field_index] = pad_llvm_type;