forked from racket/racket
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unsound fxquotient optimization.
Closes PR13827. (cherry picked from commit 5e30416)
- Loading branch information
1 parent
d04ee61
commit 4e360f8
Showing
3 changed files
with
8 additions
and
6 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
5 changes: 4 additions & 1 deletion
5
collects/tests/typed-racket/optimizer/tests/invalid-fxquotient.rkt
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#; | ||
( | ||
TR missed opt: invalid-fxquotient.rkt 10:21 (quotient fixnum-min -1) -- out of fixnum range | ||
TR missed opt: invalid-fxquotient.rkt 12:21 (quotient fixnum-min -1) -- out of fixnum range | ||
#t | ||
) | ||
|
||
#lang typed/racket/base | ||
|
||
(require racket/fixnum) | ||
|
||
(define: fixnum-min : Nonpositive-Fixnum (assert (- (expt 2 30)) fixnum?)) | ||
(define: q : Natural (quotient fixnum-min -1)) ; this can't be optimized safely | ||
(= 1073741824 q) | ||
(define (bad) (fxquotient 3 0)) ; can't be optimized |
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