Opened 7 years ago
Last modified 2 years ago
#1475 new defect
(scrutinizer) Types for global variables are not refined by predicates
| Reported by: | megane | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | someday |
| Component: | scrutinizer | Version: | 5.0.0 |
| Keywords: | Cc: | ||
| Estimated difficulty: | easy |
Description
(: g1 (list-of fixnum))
(define g1 '())
;; Aliased global gets refined
(let ((a g1))
(compiler-typecase a ((list-of fixnum) 1))
(if (null? a)
(compiler-typecase a (null 1))
(compiler-typecase a ((not null) 1))))
(: g2 (list-of fixnum))
(define g2 '())
(if (null? g2)
(compiler-typecase g2 (null 1)) ;; <- error
(compiler-typecase g2 ((pair fixnum (list-of fixnum)) 1)))
;; $ csc -O3 globals.scm
;;
;; Error: at toplevel:
;; (globals.scm:13) no clause applies in `compiler-typecase' for expression of type `(list-of fixnum)':
;; null
I don't think this is an issue of non-local mutation (e.g. from other threads). You should use mutexes or some other measures to prevent mutation while, you're working on a global.
Change History (6)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
| Milestone: | 5.1 → 5.2 |
|---|
Getting ready for 5.1, moving tickets which won't make it in to 5.2.
comment:3 Changed 6 years ago by
You can only assume that "null" is valid for g2 directly after the predicate test - any global procedure call between predicate and use could jump back via a continuation, making the assumption invalid. I don't recall, whether the scrutinizer takes this into account. Does it? If yes, then I thunk your request makes sense.
comment:5 Changed 5 years ago by
| Milestone: | 5.3 → 5.4 |
|---|
comment:6 Changed 2 years ago by
| Milestone: | 5.4 → someday |
|---|
Note: See
TracTickets for help on using
tickets.

Forgot to mention that I have a patch for this, if you think this should be fixed.