[movitz-devel] Re: Emacs on the metal

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Thu Jun 16 09:01:04 UTC 2005


Shawn Betts <sabetts at vcn.bc.ca> writes:

> I found a weird bug, too. I can't seem to create a trivial function to
> reproduce it though. basically, I have:
>
> (defun foo ()
>   (let (a)
>     (labels ((do1 ()
> 		  ;; do stuff and then
> 		  (when <stuff>
> 		    (setf a <a struct>)))
> 	     (do2 ()
> 		  ;; recursively call do2, do stuff, and then call..
> 		  (do1)))
>       (do2)
>       a)))
>
> and (foo) returns NIL instead of <a struct>. I'll keep looking into
> it for now..

I think I've nailed this bug, too. The problem was actually that
function arguments were being re-ordered (in terms of execution order)
by the compiler, and your code had a case where argument 2 was a local
function-call that modified the lexical variable that was argument 4,
and when 4 was evaluated before 2 then the side-effect of 2 wasn't
visible. There was code in the compiler to avoid this problem, but it
was incorrect. But now hopefully it's good.

-- 
Frode Vatvedt Fjeld




More information about the movitz-devel mailing list