# stage2: LLVM backend: fix crash adding alloca · gitcafe/zig

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

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

Visibility: public

Requested revision: 2a701a92c403dda47a61848a38998b474442d805

Requested commit: 2a701a92c403dda47a61848a38998b474442d805

Commit: 2a701a92c403dda47a61848a38998b474442d805

Tree: 52f69e339df727aae1a29a6009d3a4c0860e181c

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: LLVM backend: fix crash adding alloca

The logic for `buildAlloca` had a null deref when the latest alloca was
the last instruction in the entry block. Now the logic is simplified to
always insert alloca instructions first before all other instructions.

There is no longer a need to track `entry_block` or `latest_alloca_inst`;
these fields are deleted frem `FuncGen`.

```

## Parents

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

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