logo       

Typecheck hole in safety = 3, speed = 3 code: msg#00350

lisp.cmucl.devel

Subject: Typecheck hole in safety = 3, speed = 3 code

The discussion about the memory corruption reminds me I never reported
this problem I found.

Under certain conditions, a setf on a struct accessor does not check
for the type of the assignment even under maximum safety.




(declaim (optimize (safety 3) (debug 3) (speed 0)))

(defstruct foo
(bar 0 :type fixnum))

(defun test (baz)
(setf (foo-bar baz) "hello, world")
baz)

(print (foo-bar (test (make-foo))))

;; you get a compilation warning, but not a runtime error:

#|

; Compiling /home/cracauer/work/cvs-work/prg/test/lisp/safety/struct.lisp Fri,
2003-08-29 11:46:04-04:00

;
;
; File: /home/cracauer/work/cvs-work/prg/test/lisp/safety/struct.lisp

; In: DEFUN TEST

; (SETF (FOO-BAR BAZ) "Hello, World")
; --> LET* MULTIPLE-VALUE-BIND LET FUNCALL C::%FUNCALL
; ==>
; #:G0
; Warning: This is not a (VALUES &OPTIONAL FIXNUM &REST T):
; "Hello, World"
;

; Compilation unit finished.
; 1 warning

; Loading #p"/home/cracauer/work/cvs-work/prg/test/lisp/safety/struct.x86f".

"Hello, World"
NIL
:user 439 K Yes, Master?
|#




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise