| author | |
| committer | |
| log | ebfd3450d9a3338726e1ed8b08a5751b06604cd5 |
| tree | a74bf6ee7003cb7dbba333866619829c85c58659 |
| parent | 7e10cf4fbe2a8a379564941be9953ce157d483cc |
| signature |
Previously we did not write any missing padding bytes after the smallest
field (either tag or payload, depending on alignment). This resulted in
writing too few bytes and not matching the full abisize of the union.2 files changed, 6 insertions(+), 2 deletions(-)
src/arch/wasm/CodeGen.zig+2-2| ... | ... | @@ -1726,8 +1726,8 @@ fn isByRef(ty: Type, target: std.Target) bool { |
| 1726 | 1726 | |
| 1727 | 1727 | .Array, |
| 1728 | 1728 | .Frame, |
| 1729 | .Union, | |
| 1730 | => { | |
| 1729 | => return ty.hasRuntimeBitsIgnoreComptime(), | |
| 1730 | .Union => { | |
| 1731 | 1731 | if (ty.castTag(.@"union")) |union_ty| { |
| 1732 | 1732 | if (union_ty.data.layout == .Packed) { |
| 1733 | 1733 | return ty.abiSize(target) > 8; |
src/codegen.zig+4| ... | ... | @@ -611,6 +611,10 @@ pub fn generateSymbol( |
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | if (layout.padding > 0) { | |
| 615 | try code.writer().writeByteNTimes(0, layout.padding); | |
| 616 | } | |
| 617 | ||
| 614 | 618 | return Result.ok; |
| 615 | 619 | }, |
| 616 | 620 | .Optional => { |