[Openmcl-devel] Inlining bug?

Jared C. Davis jared at cs.utexas.edu
Fri Jun 15 10:19:27 PDT 2007


It seems like inlining breaks the following code on 1.1-pre-070512
(LinuxX8664) and also on
1.1-pre-070408 (LinuxX8664).

When I remove any of the "(declaim (inline ...))" calls, (len '(1 2
3)) correctly returns 3.  But when they are all present, it
incorrectly returns 0.

   (declaim (inline natp))
   (declaim (inline nfix))
   (declaim (inline nat+))

   (defun natp (x)
     (and (integerp x)
          (<= 0 x)))

   (defun nfix (x)
     (if (natp x) x 0))

   (defun nat+ (a b)
     (+ (nfix a) (nfix b)))

   (defun len (x)
     (if (consp x)
         (nat+ 1 (len (cdr x)))

   (len '(1 2 3))  ;; Incorrectly returns 0 instead of 3


Jared C. Davis <jared at cs.utexas.edu>
3600 Greystone Drive #604
Austin, TX 78731

More information about the Openmcl-devel mailing list