[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiler Error fix (srt)

      (list (setf (test-slot x)
		  (the fixnum (1+ (the fixnum (test-slot x)))))))
     .. caused double evaluation..

Thank you very much for pointing out this bug.   Actually the
slot was not getting incremented twice, but the value returned
was (1+ the updated slot value).   The fix is to specify the
side-effects correctly in cmpeval.lsp.   Change the c2structure-set
to be defined as below.

    (defstruct newborn
      (pounds :type integer)

    causes an error ("(INTEGER) is an illegal structure slot option").
    This is the example from the Reference manual.

REALLY?   in section 19.4 of the new CL II  manual by steele
[directly taken from the old manual]:
"Note that it is impossible to specivy a slot-option unless a default value is specified first."

    (defstruct newborn
      (pounds 5 :type integer)

would be legal.

Bill Schelter

;; The following (side-effects) exists for putting at the end of
;; an argument list to
;; force all previous arguments to be stored in variables, when
;; computing inline-args.    

(push '(() t t t        "Ct")      (get 'side-effects  'inline-always))

(defun c2structure-set (x name-vv ind y sd 
                          &aux locs (*vs* *vs*) (*inline-blocks* 0))
  (let* ((raw (si::s-data-raw sd))
  (type (aref *aet-types* (aref raw ind)))
  (spos (si::s-data-slot-position sd))
  (tftype (type-filter type))
  ix iy)

   (setq locs (inline-args
        (list x y (list 'call-global (make-info) 'side-effects nil))
        (if (eq type t) '(t t t)
   `(t ,tftype t))))
  (setq ix (car locs))
  (setq iy (cadr locs))
  (if *safe-compile* (wfs-error))
  (wt-nl "STSET(" (aet-c-type type )","
    ix "," (aref spos ind) ", " iy ");")
  (unwind-exit (list (inline-type tftype) nil 'wt-loc (list iy)))