diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-09-10 21:05:41 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-09-27 15:39:19 -0400 |
| commit | 67bd0267db00cf71b5f3301559a39bac32b65476 (patch) | |
| tree | 0833d087464e2a0ea5635b066dc24b6983966e10 /src/analyze.cpp | |
| parent | 70e934f116f3b889fcee755380a708fdceaaf699 (diff) | |
| download | zig-67bd0267db00cf71b5f3301559a39bac32b65476.tar.gz zig-67bd0267db00cf71b5f3301559a39bac32b65476.zip | |
Correct calculation of padding length in struct
Make sure the resulting type is in-sync with the one produced and used
by LLVM.
Fixes #3138
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index e0ba82f9b5..5d6a2d900c 100644 --- 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 - (field->offset + field_type->abi_size); + size_t pad_bytes = next_offset - llvm_next_offset; if (pad_bytes != 0) { LLVMTypeRef pad_llvm_type = LLVMArrayType(LLVMInt8Type(), pad_bytes); element_types[gen_field_index] = pad_llvm_type; |
