Commit 1c22cb5e51

Shawn Landden <shawn@git.icu>
2019-11-05 02:41:45
fix noreturn function that may return.
we do not want undefined behavior here in --release-fast and --release-small modes
1 parent 55685ae
Changed files (1)
lib
std
special
lib/std/special/c.zig
@@ -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 {