# Sema: allow comptime mutation of multiple array elements · gitcafe/zig

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

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

Visibility: public

Requested revision: 1e6d7f77639d52b61b2852cf0de19e2b5a50f31f

Requested commit: 1e6d7f77639d52b61b2852cf0de19e2b5a50f31f

Commit: 1e6d7f77639d52b61b2852cf0de19e2b5a50f31f

Tree: a921304e7e045c77279504dc53fe11a8925b589a

Author: mlugg

Committer: Veikka Tuominen

## Message

```
Sema: allow comptime mutation of multiple array elements

Previously, if you had a pointer to multiple array elements and tried to
write to it at comptime, it was incorrectly treated as a pointer to one
specific array value, leading to an assertion down the line. If we try
to mutate a value at an elem_ptr larger than the element type, we need
to perform a modification to multiple array elements.

This solution isn't ideal, since it will result in storePtrVal
serializing the whole array, modifying the relevant parts, and storing
it back. Ideally, it would only take the required elements. However,
this change would have been more complex, and this is a fairly rare
operation (nobody ever ran into the bug before after all), so it doesn't
matter all that much.

```

## Parents

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

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