< Support Home
make-hash-table in macros
ID
Created
Type
mocl Version
Dev OS
Target
Status
#67
by informatimago on 2015-03-01 (1456 days ago)
defect
14.08
Mac OS X
n/a
open
Description
Summary: Steps to Reproduce: Compile the following program: (defmacro generate (&body body) (let ((table (make-hash-table)) (forms '())) (dolist (item body) (destructuring-bind (def name &rest args) item (declare (ignore def args)) (print item) (setf (gethash name table) item))) (maphash (lambda (k v) (print v) (push v forms)) table) `(progn ,@forms))) (generate (defvar *a* 1) (defvar *b* 2)) (defun f () (+ *a* *b*)) (eval-when (:compile-toplevel) (pprint (macroexpand '(generate (defvar *a* 1) (defvar *b* 2))))) Expected Results: It is expected that no warning about variables *A* and *B* be issued. It is expected that the macroexpansion printed would be: (progn (defvar *a* 1) (defvar *b* 2)) Actual Results: We get warnings about undefined special variables. We get the following expansion: (progn) n=bug-macro-1 ; mkdir -p /tmp/${n}/src ; mocl --verbose --warn --android /tmp/${n} ${n}.lisp mocl 14.08 Copyright (C) 2013-2014 Wukix, Inc. (https://wukix.com) [Source Analysis] /Users/pjb/src/mocl/bug-macro-1.lisp defmacro generate (DEFVAR *A* 1) (DEFVAR *B* 2) defun f Warning: Assuming *A* is a global variable. Warning: Assuming *B* is a global variable. Warning: Assuming *A* is a global variable. Warning: Assuming *B* is a global variable. (DEFVAR *A* 1) (DEFVAR *B* 2) (PROGN)[Finalization] finalizing classes finalizing generic functions Warning: Function MACROEXPAND is referenced but not defined. [Optimization] dead code elimination tail recursion elimination type inference (level 0) code graph analysis substitution and simplification dead code elimination code graph analysis side effect analysis let form optimization type inference (level 2) substitution and simplification dead code elimination code graph analysis [Code Generation] /private/tmp/bug-macro-1/jni/mocl/program.h /private/tmp/bug-macro-1/jni/mocl/program.c 0 Errors, 5 Warnings Notes:
Comments
(no comments)
Log In
to add a comment.
(no comments)
Log In to add a comment.