mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
parent
97290e0bfc
commit
65a87ff299
@ -1646,20 +1646,20 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool {
|
||||
.c_va_copy,
|
||||
.c_va_end,
|
||||
.c_va_start,
|
||||
.add_safe,
|
||||
.sub_safe,
|
||||
.mul_safe,
|
||||
=> true,
|
||||
|
||||
.add,
|
||||
.add_safe,
|
||||
.add_optimized,
|
||||
.add_wrap,
|
||||
.add_sat,
|
||||
.sub,
|
||||
.sub_safe,
|
||||
.sub_optimized,
|
||||
.sub_wrap,
|
||||
.sub_sat,
|
||||
.mul,
|
||||
.mul_safe,
|
||||
.mul_optimized,
|
||||
.mul_wrap,
|
||||
.mul_sat,
|
||||
|
21
test/cases/safety/ignored expression integer overflow.zig
Normal file
21
test/cases/safety/ignored expression integer overflow.zig
Normal file
@ -0,0 +1,21 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
||||
_ = stack_trace;
|
||||
if (std.mem.eql(u8, message, "integer overflow")) {
|
||||
std.process.exit(0);
|
||||
}
|
||||
std.process.exit(1);
|
||||
}
|
||||
|
||||
pub fn main() !void {
|
||||
var x: usize = undefined;
|
||||
x = 0;
|
||||
// We ignore this result but it should still trigger a safety panic!
|
||||
_ = x - 1;
|
||||
return error.TestFailed;
|
||||
}
|
||||
|
||||
// run
|
||||
// backend=llvm
|
||||
// target=native
|
Loading…
Reference in New Issue
Block a user