# wasm: \`ptr_elem_val\` use pointer type for local · gitcafe/zig

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

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

Visibility: public

Requested revision: 969f9211622b3f2d296a6f51449605d65b66bb31

Requested commit: 969f9211622b3f2d296a6f51449605d65b66bb31

Commit: 969f9211622b3f2d296a6f51449605d65b66bb31

Tree: 0921d62ea4fd4fe0d2c97eded2064d965c5688c3

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: `ptr_elem_val` use pointer type for local

When storing the address after calculating the element's address,
ensure it's stored in a local with the correct type. Previously it
would incorrectly use the element's type, which could be a float for
example and therefore generate invalid WebAssembly code.

This change also introduces a more robust `store` function.

```

## Parents

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

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