Strange code deletion note

Bug #1036962 reported by Stas Boukarev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

(declaim (inline test test-2))

(defun test-2 (n address &optional (offset 0))
  (declare (sb-ext:muffle-conditions sb-ext:compiler-note))
  (ecase n
    (1 (sb-sys:sap-ref-8 address offset))
    (3 (sb-sys:sap-ref-32 address offset))))

(defun test (n stream)
  (declare (sb-ext:muffle-conditions sb-ext:compiler-note))
  (test-2 n stream))

(defun foo (stream)
  (the (unsigned-byte 8) (test 1 stream)))

; in: DEFUN FOO
; (THE (UNSIGNED-BYTE 8) (TEST 1 STREAM))
;
; note: deleting unreachable code

Removing THE (UNSIGNED-BYTE 8) gets rid of it, calling test-2 directly gets rid of it too, as does calling (test 3 stream).

Revision history for this message
Alastair Bridgewater (alastair-bridgewater) wrote :

Unable to reproduce with 1.3.9.74-b7f16a3, either as individual forms pasted at the REPL or via COMPILE-FILE.

Revision history for this message
Stas Boukarev (stassats) wrote :

(declaim (inline test test-2))

(defun test-2 (n stream &optional (offset 0))
  (ecase n
    (1 (sb-sys:sap-ref-8 stream offset))
    (3 (sb-sys:sap-ref-32 stream offset))))

(defun test (n stream)
  (test-2 n stream))

(defun offset (stream)
  (the (unsigned-byte 8) (test 1 stream)))

Can trigger a note, but it's not so strange anymore, the usual stuff from SB-C::NOTE-BLOCK-DELETION looking up symbols the source tree. And THE no longer influences it.

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.