-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.optimization
Milestone
Description
In theory we could sometimes take advantage of SIGFPE for our integer division by zero safety check:
test "integer division by zero" {
@setRuntimeSafety(false);
var x: i32 = 10;
var y: i32 = 0;
var z = x / y;
_ = z;
}
$ stage3/bin/zig test test3.zig
Test [1/1] test.integer division by zero... Arithmetic exception at address 0x20de9a
./test3.zig:5:5: 0x20de9a in test.integer division by zero (test)
var z = x / y;
^
However, we still need safety checks sometimes, in the case of:
- architectures that do not have such exceptions for integer division
- LLVM, which declares integer division by zero as undefined behavior
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.optimization