-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent SafeInt from throwing exceptions on bitshift overflows.
Closes #1829.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
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,2 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
uncaught exception hilti::rt::Overflow: overflow detected (<...>/shift-overflow.hlt:12:1-12:33) |
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,21 @@ | ||
# @TEST-DOC: Checks that overflows on bitshifts cause exceptions, regression test for #1829. | ||
# | ||
# TODO: Revisit this once https://github.com/dcleblanc/SafeInt/pull/64 moved forward. | ||
# | ||
# @TEST-EXEC-FAIL: hiltic -dj %INPUT >output 2>&1 | ||
# @TEST-EXEC: btest-diff output | ||
|
||
module overflow { | ||
|
||
import hilti; | ||
|
||
hilti::print(uint8(0) << 8, True); | ||
hilti::print(uint16(0) << 16, True); | ||
hilti::print(uint32(0) << 32, True); | ||
hilti::print(0 << 64, True); | ||
hilti::print(uint8(0) << 8, True); | ||
hilti::print(uint16(0) << 16, True); | ||
hilti::print(uint32(0) << 32, True); | ||
hilti::print(0 << 64, True); | ||
|
||
} |