GNU bug report logs - #50268
28.0.50; Assertion warning during native compilation

Previous Next

Package: emacs;

Reported by: Michael Welsh Duggan <md5i <at> md5i.com>

Date: Mon, 30 Aug 2021 14:06:02 UTC

Severity: normal

Merged with 50720

Found in version 28.0.50

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#50720: closed (unnamed &rest broken)
Date: Sat, 25 Sep 2021 18:38:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 25 Sep 2021 20:37:11 +0200
with message-id <09E998E0-89D9-4782-AC4B-F415E3F3EE5B <at> acm.org>
and subject line Re: bug#50268: 28.0.50; Assertion warning during native compilation
has caused the debbugs.gnu.org bug report #50268,
regarding unnamed &rest broken
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
50268: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50268
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: unnamed &rest broken
Date: Tue, 21 Sep 2021 13:15:54 +0200
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.



[Message part 3 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 50268-done <at> debbugs.gnu.org,
 Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#50268: 28.0.50; Assertion warning during native compilation
Date: Sat, 25 Sep 2021 20:37:11 +0200
24 sep. 2021 kl. 08.07 skrev Eli Zaretskii <eliz <at> gnu.org>:

> Let's do it now.

Thank you, pushed to master. Closing.



This bug report was last modified 3 years and 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.