2022-05-13 15:00:20 +08:00
|
|
|
const std = @import("std");
|
|
|
|
|
2022-09-15 05:43:48 +08:00
|
|
|
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
2022-05-13 15:00:20 +08:00
|
|
|
_ = stack_trace;
|
2022-08-05 22:47:01 +08:00
|
|
|
if (std.mem.eql(u8, message, "integer overflow")) {
|
|
|
|
std.process.exit(0);
|
|
|
|
}
|
|
|
|
std.process.exit(1);
|
2022-05-13 15:00:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() !void {
|
|
|
|
const x = div(-32768, -1);
|
|
|
|
if (x == 32767) return error.Whatever;
|
|
|
|
return error.TestFailed;
|
|
|
|
}
|
|
|
|
fn div(a: i16, b: i16) i16 {
|
|
|
|
return @divTrunc(a, b);
|
|
|
|
}
|
|
|
|
// run
|
2022-08-05 22:47:01 +08:00
|
|
|
// backend=llvm
|
|
|
|
// target=native
|