diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-07-12 13:06:51 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-12 21:34:20 -0400 |
| commit | 2eaef84ebe968224b0cf25206abf12ea1c5e0f5a (patch) | |
| tree | e1fe357fb3dac1e21fd90c143d2ecc5396d3c470 /test/behavior/array.zig | |
| parent | 7090f0471c0169c60a9476b537b09eebe1bdf6af (diff) | |
| download | zig-2eaef84ebe968224b0cf25206abf12ea1c5e0f5a.tar.gz zig-2eaef84ebe968224b0cf25206abf12ea1c5e0f5a.zip | |
stage2 llvm: Use unpacked struct for unions and arrays
Our lowerings for various LLVM types assume that we can anticipate the
alignment/layout that LLVM will generate. Among other things, this
requires that we keep the alignment of our lowered LLVM types
synchronized with their expected alignment in Zig.
- Arrays were using packed struct types, which is seems to be
incorrect since array elements are supposed to be self-aligned.
- Unions were using packed struct types for their payload, which causes
layout divergence between what stage2 expects and what LLVM generates
Consider this lowered union type:
```llvm
%Value = type { <{ i64, [8 x i8] }>, i1, [7 x i8] } ; 24 bytes, align(1)
%ErrorUnion = type { %Value, i16 } ; 26 bytes, align(2)
```
Zig expects Value to be align(8) and, by extension, for ErrorUnion to be
size 32.
Diffstat (limited to 'test/behavior/array.zig')
0 files changed, 0 insertions, 0 deletions
