ecl issueshttps://gitlab.common-lisp.net/ecl/ecl/-/issues2018-05-12T05:17:08Zhttps://gitlab.common-lisp.net/ecl/ecl/-/issues/1Invalid C code emitted for nested let/flet/flet2018-05-12T05:17:08ZMichael RaskinInvalid C code emitted for nested let/flet/fletCompiling the following code:
```
(defun test-fun (arg form)
(let*
((m 'list))
(labels
((f () (funcall m)))
(labels
( (g (&rest args)
(if args (apply #'f arg args) (f))))
(g ...Compiling the following code:
```
(defun test-fun (arg form)
(let*
((m 'list))
(labels
((f () (funcall m)))
(labels
( (g (&rest args)
(if args (apply #'f arg args) (f))))
(g form)))))
```
leads to `aux_closure` being used but undefined (and `gcc` returning an error).
(This is actually an expanded/simplified version of `hu.dwim.walker` code)
Merging two `flet` into a single `labels` or replacing `(if args …` with `(if t …` or replacing `(funcall m)` with `(funcall 'list)` doesn't create undefined variable reference in the emitted C code.https://gitlab.common-lisp.net/ecl/ecl/-/issues/2Multiple values returned from PROG1 when body is empty2020-12-20T15:53:10ZMichał Herdaphoe@disroot.orgMultiple values returned from PROG1 when body is empty`(prog1 (values 1 2 3))` is supposed to return only the primary value.
Possible fix at https://gitlab.common-lisp.net/ecl/ecl/-/blob/develop/src/lsp/evalmacros.lsp#L233-239:
```lisp
(defmacro prog1 (first &rest body &aux (sym (gensym))...`(prog1 (values 1 2 3))` is supposed to return only the primary value.
Possible fix at https://gitlab.common-lisp.net/ecl/ecl/-/blob/develop/src/lsp/evalmacros.lsp#L233-239:
```lisp
(defmacro prog1 (first &rest body &aux (sym (gensym)))
"Syntax: (prog1 first-form {form}*)
Evaluates FIRST-FORM and FORMs in order. Returns the value of FIRST-FORM."
(if (null body) `(values ,first)
`(LET ((,sym ,first))
; (DECLARE (:READ-ONLY ,sym)) ; Beppe
,@body ,sym)))
```