Opened 9 years ago
Closed 5 years ago
#1258 closed defect (fixed)
At higher optimization levels, some scrutiny warnings disappear
Reported by: | sjamaan | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 5.2 |
Component: | scrutinizer | Version: | 5.0.0 |
Keywords: | Cc: | ||
Estimated difficulty: | hard |
Description
(use data-structures) (print (sort '(x y z) (lambda (a b) (> a b))))
When compiled with -O2
or lower, this gives the warning:
Warning: at toplevel: (/tmp/test.scm:5) in procedure call to `sort', expected argument #2 of type `(procedure (symbol symbol) *)' but was given an argument of type `(procedure (number number) boolean)'
When compiled with -O3
or higher, no output is given.
The warning is always shown in master, as far as I can tell.
Change History (6)
comment:1 Changed 8 years ago by
Estimated difficulty: | → hard |
---|
comment:2 Changed 8 years ago by
comment:3 Changed 8 years ago by
Priority: | major → minor |
---|---|
Version: | 4.10.x → 5.0 |
comment:4 Changed 7 years ago by
Milestone: | 5.0 → 5.1 |
---|
comment:5 Changed 5 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:6 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Commit bc72c05fa61581fc1fa86e90000a002847c3f28b removed the generalization in types.db.
Note: See
TracTickets for help on using
tickets.
As pointed out by TheLemonMan?, this is caused by the rewrite for
>
that was introduced by c493d5100. The diff is:Apparently the rewrite happens so early that the scrutinizer has no opportunity to detect that the argument to
sort
is wrong.The rewrite itself seems correct to me, because it is more efficient than rewriting only numbers, if the compiler doesn't know the types (
C_i_greaterp
will raise a runtime error if it is passed non-numbers).