# avoid setting \`tail\` for \`@panic\` · gitcafe/zig

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

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

Visibility: public

Requested revision: 257fded70cc456f0c4c2a56f845cf7f21e738674

Requested commit: 257fded70cc456f0c4c2a56f845cf7f21e738674

Commit: 257fded70cc456f0c4c2a56f845cf7f21e738674

Tree: bb2ab8d0f241b7c37ef2d99ff5b798dde4edfa48

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
avoid setting `tail` for `@panic`

Currently, slices are passed via reference, even though it would be
better to pass the ptr and len as separate arguments (#561). This means
that any function call with a slice parameter cannot be a tail call,
because according to LLVM spec:

> Both [tail,musttail] markers imply that the callee does not access
> allocas from the caller

There was one other place we were setting `tail` and I made that
conditional on whether or not the argument referenced allocas in the
caller.

This was causing undefined behavior in the compiler when it hit asserts,
causing it to print garbage memory to the terminal. See #3262 for
example.

```

## Parents

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

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