diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-18 18:30:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-12-18 18:30:06 -0700 |
| commit | f416535768fc30195cad6cd481f73fd1e80082aa (patch) | |
| tree | 2ec26d70f41a1382b736b606ebfa094ace62573e /lib | |
| parent | 53987c932c9d62cc9cdae3d523fb62756ce83ca9 (diff) | |
| download | zig-f416535768fc30195cad6cd481f73fd1e80082aa.tar.gz zig-f416535768fc30195cad6cd481f73fd1e80082aa.zip | |
work around compiler bug regarding generic function slice alignment
See #7495
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/crypto/tlcsprng.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/crypto/tlcsprng.zig b/lib/std/crypto/tlcsprng.zig index 384216a81b..ee71d6f13e 100644 --- a/lib/std/crypto/tlcsprng.zig +++ b/lib/std/crypto/tlcsprng.zig @@ -117,7 +117,9 @@ fn setupPthreadAtforkAndFill(buffer: []u8) void { } fn childAtForkHandler() callconv(.C) void { - const wipe_slice = @ptrCast([*]u8, &wipe_me)[0..@sizeOf(@TypeOf(wipe_me))]; + // TODO this is a workaround for https://github.com/ziglang/zig/issues/7495 + var wipe_slice: []u8 = undefined; + wipe_slice = @ptrCast([*]u8, &wipe_me)[0..@sizeOf(@TypeOf(wipe_me))]; std.crypto.utils.secureZero(u8, wipe_slice); } |
