zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 09575bc0d605ca59bba19e98b66d0d0b1ba4fa89 (tree)
parent 67bd0267db00cf71b5f3301559a39bac32b65476
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 27 Sep 2019 15:53:30 -0400

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.

Diffstat:
Msrc/analyze.cpp | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/analyze.cpp b/src/analyze.cpp @@ -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;