-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmgen: respect overflow checks for 64-bit negation (#1408)
## Summary Negation of 64-bit integers didn't respect the overflow check setting, resulting in overflow defects even when the checks are disabled. This is now fixed. Fixes #1406. ## Details The VM presently doesn't support unchecked negation. For ease of implementation, unchecked negation is emulated in bytecode as `not(x) + 1`.
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
discard """ | ||
description: ''' | ||
Ensure that disabling overflow checks works for 32-bit integer negations | ||
''' | ||
targets: "c js vm" | ||
matrix: "--overflowChecks:off" | ||
""" | ||
|
||
var x = low(int32) | ||
discard -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
discard """ | ||
description: ''' | ||
Ensure that disabling overflow checks works for 64-bit integer negations | ||
''' | ||
targets: "c js vm" | ||
matrix: "--overflowChecks:off" | ||
""" | ||
|
||
var x = low(int64) | ||
discard -x |