# wasm: correctly use elem type when lowering · gitcafe/zig

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

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

Visibility: public

Requested revision: 061d99285d5a73a71a97ed7bbb45f0a7f65acf2d

Requested commit: 061d99285d5a73a71a97ed7bbb45f0a7f65acf2d

Commit: 061d99285d5a73a71a97ed7bbb45f0a7f65acf2d

Tree: 844a8219a345ef94eab7b8e6df04eccd0e40c2e0

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: correctly use elem type when lowering

Previously when lowering a value of `elem_ptr` we would multiply the
abisize of the parent type by the index, rather than the element type.
This would result in an invalid pointer way beyond the correct pointer.

We now also pass the current offset to each recursive call to ensure
we do not miss inner offsets.

```

## Parents

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

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