CTYPE leakage from SETQ

Bug #890750 reported by Paul Khuong
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

We splice CTYPEs in directly instead of using a type specifier when ir1 converting setq. Should we try and detect these meta-level leakage issues during ir1-conversion, or do we (want to) actively depend on that being possible?

Test case by Zach Beane:

;;;; foo.lisp

(defun foo ()
  (let ((em 0d0))
    (declare (type double-float em))
    (dotimes (i 42)
      (setf em (float (1+ i))))))

;;;; (compile-file "foo.lisp")

; compiling file "/tmp/foo.lisp" (written 15 NOV 2011 10:59:09 AM):
; compiling (DEFUN FOO ...)

; file: /tmp/foo.lisp
; in: DEFUN FOO
; (SETF EM (FLOAT (1+ I)))
; --> SETQ THE SB-C::%COMPILE-TIME-TYPE-ERROR
; ==>
; '((THE #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> (FLOAT (1+ I)))
; SB-KERNEL:%SINGLE-FLOAT SB-C::N)
;
; caught ERROR:
; SB-KERNEL:NUMERIC-TYPE (supertype of SB-KERNEL:NUMERIC-TYPE) is not a DEF!STRUCT-defined type.

; --> SETQ THE
; ==>
; (SB-C::%COMPILE-TIME-TYPE-ERROR 'SB-C::DUMMY 'DOUBLE-FLOAT
; '(VALUES (SINGLE-FLOAT 1.0) &OPTIONAL)
; '((THE #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT>
; (FLOAT (1+ I)))
; SB-KERNEL:%SINGLE-FLOAT SB-C::N))
;
; note: The fourth argument never returns a value.

; (DOTIMES (I 42) (SETF EM (FLOAT (1+ I))))
; --> DO BLOCK LET TAGBODY PSETQ PSETF LET* MULTIPLE-VALUE-BIND LET 1+ +
; ==>
; I
;
; note: deleting unreachable code
;
; compilation unit finished
; caught 1 ERROR condition
; printed 2 notes

; /tmp/foo.fasl written
; compilation finished in 0:00:00.006

Tags: compiler-ir1
Paul Khuong (pvk)
tags: added: compiler-ir1
Revision history for this message
Paul Khuong (pvk) wrote :

Fix committed in 5efae23 Plug a CTYPE leak into fasls via SETQ.

Stas Boukarev (stassats)
Changed in sbcl:
status: In Progress → Fix Committed
Paul Khuong (pvk)
Changed in sbcl:
assignee: Paul Khuong (pvk) → nobody
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.