# Sema: Fix invalid AIR generation for switch loop with comptime discarded tag · gitcafe/zig

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

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

Visibility: public

Requested revision: 29ac68b2537b9a9c67f92cc2a5dd4c35bf1c2b31

Requested commit: 29ac68b2537b9a9c67f92cc2a5dd4c35bf1c2b31

Commit: 29ac68b2537b9a9c67f92cc2a5dd4c35bf1c2b31

Tree: a05c443ab692add1dabd0f504d28c5ca21e9ef01

Author: Justus Klausecker

Committer: Andrew Kelley

## Message

```
Sema: Fix invalid AIR generation for switch loop with comptime discarded tag
Add an additional check before emitting `.loop_switch_br` instead
of `.switch_br` in a tagged switch statement for whether any of the
continues referencing its tag are actually runtime reachable.
This fixes triggering an assertion in Liveness caused by the invalid
assumption that every tagged switch must be a loop if its tag is
referenced in any way even if this reference is not runtime reachable.

```

## Parents

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

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