GNU bug report logs -
#50720
unnamed &rest broken
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Tue, 21 Sep 2021 11:17:01 UTC
Severity: normal
Merged with 50268
Found in version 28.0.50
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50720 in the body.
You can then email your comments to 50720 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50720
; Package
emacs
.
(Tue, 21 Sep 2021 11:17:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mattias Engdegård <mattiase <at> acm.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 21 Sep 2021 11:17:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The interpreter and compiler allow &rest to be used without a variable name following but the generated byte code is completely broken:
(funcall (byte-compile (lambda (&rest) 'ta)))
crashes, and
(defun boo (a &rest)
(if a a (list 1 2 3 4)))
(boo 'hiss)
=> hiss ; interpreted
=> (1 2 3 4) ; compiled
The reason is that the compiler generates code from the argument variable list but the byte-code interpreter will only look at the signature code which was generated from the actual signature:
(byte-compile (lambda (&rest) 'ta))
=> #[128 "\300\207" [ta] 1 "..."]
The 128 indicates zero positional parameters and a &rest argument, and the 1 is the maximum stack size required which is wrong; 2 stack slots are needed and that's what we get if naming the argument:
(byte-compile (lambda (&rest _r) 'ta))
=> #[128 "\300\207" [ta] 2 "..."]
In the `boo` case above, it is clear that the compiler doesn't expect any &rest param to have been pushed at all so the stack offsets are wrong.
Now, either we fix this bug or we stop pretending that unnamed &rest arguments work at all and signal an error, because it's clear from the above that they can't have seen much use.
Merged 50268 50720.
Request was from
Andrea Corallo <akrl <at> sdf.org>
to
control <at> debbugs.gnu.org
.
(Tue, 21 Sep 2021 15:55:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50720
; Package
emacs
.
(Tue, 21 Sep 2021 16:12:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 50720 <at> debbugs.gnu.org (full text, mbox):
Mattias Engdegård <mattiase <at> acm.org> writes:
> Now, either we fix this bug or we stop pretending that unnamed &rest
> arguments work at all and signal an error, because it's clear from the
> above that they can't have seen much use.
I did a quick grep through core and GNU ELPA, and I couldn't find any
instances of it being used, so I'd be fine with either solution (i.e.,
either fixing the bug or signalling an error).
Perhaps Eli has an opinion (added to the CCs).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50720
; Package
emacs
.
(Tue, 21 Sep 2021 16:23:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 50720 <at> debbugs.gnu.org (full text, mbox):
21 sep. 2021 kl. 18.11 skrev Lars Ingebrigtsen <larsi <at> gnus.org>:
> I did a quick grep through core and GNU ELPA, and I couldn't find any
> instances of it being used, so I'd be fine with either solution (i.e.,
> either fixing the bug or signalling an error).
I know how to fix it but there's no really elegant way of doing it, and unless a convincing case can be made for permitting anonymous &rest, I'd favour disallowing it.
Unless I'm mistaken it was Noam who added it (1d47d777ef24c0be9153b0a1c8ba21918fa1025a), so let's ask him.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50720
; Package
emacs
.
(Tue, 21 Sep 2021 16:27:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 50720 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 50720 <at> debbugs.gnu.org, 50268 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
> Date: Tue, 21 Sep 2021 18:11:34 +0200
>
> Mattias Engdegård <mattiase <at> acm.org> writes:
>
> > Now, either we fix this bug or we stop pretending that unnamed &rest
> > arguments work at all and signal an error, because it's clear from the
> > above that they can't have seen much use.
>
> I did a quick grep through core and GNU ELPA, and I couldn't find any
> instances of it being used, so I'd be fine with either solution (i.e.,
> either fixing the bug or signalling an error).
>
> Perhaps Eli has an opinion (added to the CCs).
I think I'd like to at least see the prototype of the fix to have an
opinion.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 24 Oct 2021 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 190 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.