# AstGen: fix referencing unreferencable instructions · gitcafe/zig

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

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

Visibility: public

Requested revision: cf4aad4858ac61b4814d8f021c8eae22ee7f63e6

Requested commit: cf4aad4858ac61b4814d8f021c8eae22ee7f63e6

Commit: cf4aad4858ac61b4814d8f021c8eae22ee7f63e6

Tree: 24b38ed2af8bc40ffa056b5deb3d932916d8c770

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
AstGen: fix referencing unreferencable instructions

Sema avoids adding map entries for certain instructions such as
`set_eval_branch_quota` and `atomic_store`. This means that result
location semantics in AstGen must not emit any instructions that attempt
to use the result of any of these instructions.

This commit makes AstGen replace such instructions with
`Zir.Inst.Ref.void_value` if their result value ends up being
referenced.

This fixes a compiler crash when running std lib atomic tests.

```

## Parents

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

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