fix noreturn function that may return.

we do not want undefined behavior here in --release-fast
and --release-small modes
This commit is contained in:
Shawn Landden 2019-11-04 17:41:45 -08:00 committed by Andrew Kelley
parent 55685ae780
commit 1c22cb5e51

View File

@ -82,9 +82,11 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn
if (builtin.is_test) {
@setCold(true);
std.debug.panic("{}", msg);
} else {
unreachable;
}
if (builtin.os != .freestanding) {
std.os.abort();
}
while (true) {}
}
export fn memset(dest: ?[*]u8, c: u8, n: usize) ?[*]u8 {