Hi !
I've encountered a problem that I fail to understand. Consider the following
file test.cl:
(eval-when (:compile-toplevel)
(if *optimize*
(declaim (optimize (speed 3)
(compilation-speed 0)
(safety 0)
(debug 0)))
(declaim (optimize (speed 0)
(compilation-speed 0)
(safety 3)
(debug 0))))
(if *inline*
(declaim (inline fill-array))
(declaim (notinline fill-array))))
(defun new-array (size)
(declare (type fixnum size))
(make-array (* size size)
:element-type #+float 'single-float #-float 'fixnum
:initial-element #+float 0.0 #-float 0))
(defun fill-array (array value)
(declare (type (simple-array #+float single-float
#-float fixnum (*)) array))
(declare (type #+float single-float #-float fixnum value))
(let ((size (array-dimension array 0)))
(dotimes (i size)
(setf (aref array i) (+ (aref array i) value))))
nil)
(defun main ()
(let ((a (new-array 10)))
(fill-array a #+float 1.1 #-float 1)))
I want to compile this file with different settings for *optimize*, *inline*
and the :float *feature*. If I compile it on the command-line in two separate
lisp instances, everything goes well:
lisp -eval "(progn (setf *optimize* t *inline* t) (compile-file \"test.cl\"
:byte-compile nil))"
lisp -eval "(progn (setf *optimize* nil *inline* nil) (pushnew :float
*features*) (compile-file \"test.cl\" :byte-compile nil))"
However, if I automate this compilation, I get strange warnings. The
compilation file is here:
(defvar *optimize* nil)
(defvar *inline* nil)
(defun compile-files ()
(let ((*optimize* t)
(*inline* t))
(compile-file "test.cl" :output-file "test1.x86f"))
(pushnew :float *features*)
(compile-file "test.cl" :output-file "test2.x86f" :byte-compile nil))
Running this file with: lisp -load "compile.cl" -eval "(compile-files)"
gives this:
; In: DEFUN MAIN
; (NEW-ARRAY 10)
; Warning: Result is a (SIMPLE-ARRAY SINGLE-FLOAT
; (*)), not a (VALUES &OPTIONAL (SIMPLE-ARRAY FIXNUM #)
&REST T).
;
; (FILL-ARRAY A 1.1)
; Warning: This is not a (VALUES &OPTIONAL FIXNUM &REST T):
; 1.1
;
; Note: Deleting unreachable code.
;
; Compiling Top-Level Form:
; Compilation unit finished.
; 2 warnings
; 1 note
It seems to me that some side effects of the first compilation affect the
second one, but I never loaded any of those files.
Any help appreciated, thanks !
--
Didier Verna, [EMAIL PROTECTED], http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-BicĂȘtre, France Fax.+33 (1) 53 14 59 22 [EMAIL PROTECTED]