Opened 9 years ago
Last modified 7 years ago
#1215 new enhancement
Warn about too specific type declarations
Reported by: | Moritz Heidkamp | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | someday |
Component: | scrutinizer | Version: | 4.10.x |
Keywords: | Cc: | ||
Estimated difficulty: | hard |
Description
The following program produces code that may segfault when compiled with specialization:
(: foo (-> string)) (define (foo) (read)) (print (string-ref (foo) 0))
$ csc -specialize foo.scm echo '"foo"' | ./foo f $ echo 123 | ./foo Error: segmentation violation Call history: baz.scm:5: foo baz.scm:3: read <--
I think the root cause is that the declared return type of foo
is more specific than that of read
. Perhaps this could be detected by the scrutinizer and warned about accordingly.
Change History (2)
comment:1 Changed 8 years ago by
Estimated difficulty: | → hard |
---|
comment:2 Changed 7 years ago by
Note: See
TracTickets for help on using
tickets.
I added this feature, but it produces far too many warnings. Stuff like this:
We could add all sorts of rules about whether to issue a warning or not in order to cut down on the noise, but I'm not sure this feature would be worth the added complexity. Plus, we already issue a warning when the types are incompatible, so I'm more inclined to just close this wontfix.