# wasm: aggregate_init \- ensure zeroed result local · gitcafe/zig

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

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

Visibility: public

Requested revision: 832330094c00391ecd6f0ea4abf2d05261b5a10c

Requested commit: 832330094c00391ecd6f0ea4abf2d05261b5a10c

Commit: 832330094c00391ecd6f0ea4abf2d05261b5a10c

Tree: e4405f62cb2b698c00504f08059cf7f89cf5291d

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: aggregate_init - ensure zeroed result local

When initializing a packed struct, we must ensure the result local
is zero'd. Previously we would do this by ensuring a new local is
allocated. Although a local is always zero by default, it meant that
if such an initialization was being done inside a loop, it would re-
use that very same local that could potentially still hold a different
value. Because this value is `or`'d with the value, it would result
in a miscompilation. By manually setting this result to 0, we guarantee
the correct behavior.

```

## Parents

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

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