Opened 2 years ago

Last modified 13 months ago

#1215 new enhancement

Warn about too specific type declarations

Reported by: syn 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 (1)

comment:1 Changed 13 months ago by sjamaan

  • Estimated difficulty set to hard
Note: See TracTickets for help on using tickets.