# llvm: Don't emit safety memset\(\) for stores of undef in Debug with safety off\. · gitcafe/zig

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

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

Visibility: public

Requested revision: 1c35e73b614398529782f8c027366c6d8d51ac4b

Requested commit: 1c35e73b614398529782f8c027366c6d8d51ac4b

Commit: 1c35e73b614398529782f8c027366c6d8d51ac4b

Tree: 250c777f79bd747416f105111592fc7c79a344d6

Author: Alex Rønne Petersen

Committer: Andrew Kelley

## Message

```
llvm: Don't emit safety memset() for stores of undef in Debug with safety off.

Before, this code:

    @setRuntimeSafety(false);
    var arr: [38]elf.Addr = undefined;

would emit a call to memset() in the output code in Debug mode, while in all the
release modes, LLVM optimized the memset() out as expected. Emitting the call in
Debug mode is problematic in some contexts, e.g. in std.os.linux.start_pie where
we are not yet ready to correctly perform calls because relocations haven't been
applied yet, or in the early stages of a dynamic linker, etc.

```

## Parents

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

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