[Ecls-list] Compiler generating bad C code

Josh Elsasser josh at elsasser.org
Fri Jul 11 22:31:49 UTC 2008


I found some code which seems to cause the compiler to emit bad C
code, causing gcc to error out on an undefined variable. I have
simplified the code down to the following:

(defun testfun-map (fn list)
  (mapcar fn list))

(defun testfun (outer)
  (labels ((testlabel (inner)
             (if inner
                 (testfun-map
                  (lambda (x) (testlabel x))
                  inner))
             (print outer)))
    (testlabel outer)))

The bad C code seems to be for the lambda call to testlabel, it
references env0 which was not declared in the argument list to the
lambda.




More information about the ecl-devel mailing list