Subject: compile( ) bug -- not the compiler, actually
From: Richard Fateman
Date: Thu, 22 Apr 2010 08:29:20 -0700
Camm Maguire wrote:
> Greetings! All I have is the latest 5.21.0, but on my Debian system:
>
> camm at localhost:~/debian/gcl/gcl-2.6.8pre/o$ maxima
>
> Maxima 5.21.0 http://maxima.sourceforge.net
> using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1) g(x):=is(x>10);
> (%o1) g(x) := is(x > 10)
> (%i2) f(x):=if g(x) then 1 else 2;
> (%o2) f(x) := if g(x) then 1 else 2
> (%i3) f(11);
> (%o3) 1
> (%i4) compile(f);
>
> Compiling /tmp/gazonk_6854_0.lsp.
> End of Pass 1.
> End of Pass 2.
> OPTIMIZE levels: Safety=2, Space=3, Speed=3
> Finished compiling /tmp/gazonk_6854_0.lsp.
> (%o4) [f]
> (%i5)
>
> Is this Windows?
>
> Take care,
>
>
> Jaime Villate <villate at fe.up.pt> writes:
>
>
>> On Wed, 2010-04-21 at 22:34 -0700, Richard Fateman wrote:
>>
>>> g(x):=is(x>10);
>>>
>>> f(x):=if g(x) then 1 else 2;
>>>
>>> f(11); works ... but
>>>
>>> compile(f);
>>> f(11); crashes with "the variable $g is unbound"
>>>
>>> on GCL maxima 5.20.1
>>>
>> It seems to be a GCL problem, because it works fine for me in 5.20.1
>> with either CLisp, SBCL or Clozure Lisp.
>> Regards,
>> Jaime
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>>
>>
>>
>
>
Yes, it is windows XP
Actually, a version that is not compiled but merely translated to lisp,
also fails, the same way.
So it is not a bug in the lisp compiler.
after translate(f), I see..
to_lisp();
(symbol-plist '$f)
(TRANSLATED T FUNCTION-MODE $FIXNUM ONCE-TRANSLATED
"I was once translated" MPROPS
(NIL MEXPR ((LAMBDA) ((MLIST) $X) ((MCOND) (($G) $X) 1 T 2)))
SYSTEM:PNAME "$F")
So maybe there is something wrong with the handling of mcond in
translated code.
A program like this: f(x):= if x>10 then 1 else 2 works fine.
I will try downloading 5.21.0
RJF