Re: Bug report: compiling macrolet with defun inside

Raymond Toy <[email protected]> Sun, 6 Apr 2025 18:24:21 -0700
Newsgroups gmane.lisp.gcl.devel
Message-ID <[email protected]>
On 4/6/25 2:16 PM, Camm Maguire wrote:

> Greetings, and thank you so much for your report!
>
> I've pushed a fix to git branch gnu-build-system, which will appear in
> release 2.7.0 shortly.

Fantastic! I build 2.7.0 and can confirm the macrolet issue is fixed.

However, I do have a build issue. I had to run autoconf again because I 
don’t have aclocal-1.17. Everything built fine. But then I did make 
install. When I run the installed gcl, it can’t find 
/usr/lib/gcl-2.7.0/unixport/saved_gcl. I ran “configure 
–prefix=$HOME/dev/gcl-2.7.0”. There is saved_gcl in 
$HOME/dev/gcl-2.7.0/lib/gcl-2.7.0/unixport/saved_gcl, as I would have 
expected.

> Take care,
>
> David Scherfgen<[email protected]> writes:
>
>> Dear GCL developers,
>>
>> Here's another bug(?) I encountered.
>>
>> The following code works correctly when entering it directly into the REPL. But compiling it doesn't work correctly.
>>
>> Place this in a file bug.lisp:
>>
>> (macrolet ((impl (op) `(,op x y)))
>>    (defun add (x y) (impl +)))
>>
>> This defines a function add (x y) with the body (+ x y).
>> Compile it:
>>
>> (compile-file "bug.lisp")
>>
>> The compiler gives some warnings that already indicate that something is wrong:
>>
>> ; (DEFUN ADD ...) is being compiled.
>> ;; Warning: The variable X is not used.
>> ;; Warning: The variable Y is not used.
>>
>> Load the compiled file and try to call add:
>>
>> (load "bug.o")
>> (add 3 4)
>>
>> The following error is shown:
>>
>> Condition in ADD [or a callee]: INTERNAL-SIMPLE-TYPE-ERROR: IMPL is not of type FUNCTION:
>>
>> The compiler failed to expand the impl macro and treated it like a function!
>>
>> Tested with GCL 2.6.14.
>>
>> Best regards
>> David Scherfgen
>>
&#8203;