# riscv: fix logic bug in \`ptr_elem_ptr\` · gitcafe/zig

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

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

Visibility: public

Requested revision: 81ca3a1d594cb25dcd7dbedf175dd9931cad0d0f

Requested commit: 81ca3a1d594cb25dcd7dbedf175dd9931cad0d0f

Commit: 81ca3a1d594cb25dcd7dbedf175dd9931cad0d0f

Tree: a192c596e186cca2bcd37808eeda28a456613ad2

Author: David Rubin

Committer: David Rubin

## Message

```
riscv: fix logic bug in `ptr_elem_ptr`

I was doing duplicate work with `elemOffset` multiplying by the abi size and then the `ptr_add` `genBinOp` also multiplying.

This led to having writes happening in the wrong place.

```

## Parents

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

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