# stage1: fix incorrect struct padding · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/11911f55a73a49e2fda85bddd38d1993b93547c9)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 11911f55a73a49e2fda85bddd38d1993b93547c9

Requested commit: 11911f55a73a49e2fda85bddd38d1993b93547c9

Commit: 11911f55a73a49e2fda85bddd38d1993b93547c9

Tree: 0ee9eb36a44a230fb356aec6f0e056b3e74c186a

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

````
stage1: fix incorrect struct padding

Before this change, struct {f80, f80} targeting i386-windows-msvc lowers
to

```llvm
%"std.testing.struct:78:61.6" = type { x86_fp80, [6 x i8], x86_fp80, [6 x i8] }
```

which has an incorrect ABI size of 40. After this change, the struct
lowers to

```llvm
%"std.testing.struct:78:61.6" = type { x86_fp80, [4 x i8], x86_fp80, [4 x i8] }
```

which has the correct ABI size of 32, and properly aligns the second
field to 16 bytes.

The other place that calculates field padding (lowering of constant
values in codegen.cpp) already correctly calls LLVMABISizeOfType
rather than LLVMStoreSizeOfType.

This fixes the compiler-rt tests for i386-windows in this branch.

````

## Parents

- [9d098657a069b36e3eed9bc63c3421c031be7348](https://git.cafe/gitcafe/zig/commit/9d098657a069b36e3eed9bc63c3421c031be7348?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/11911f55a73a49e2fda85bddd38d1993b93547c9?format=markdown)
