From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#50720: unnamed &rest broken Date: Tue, 21 Sep 2021 13:15:54 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33558"; mail-complaints-to="usenet@ciao.gmane.io" To: 50720@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 21 13:17:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSdlw-0008UA-2J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 13:17:12 +0200 Original-Received: from localhost ([::1]:60540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSdlt-00063L-HQ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 07:17:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSdlm-000618-JY for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 07:17:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSdlm-00057K-A1 for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 07:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mSdlm-0001TN-22 for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 07:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Sep 2021 11:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50720 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16322229675578 (code B ref -1); Tue, 21 Sep 2021 11:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Sep 2021 11:16:07 +0000 Original-Received: from localhost ([127.0.0.1]:45073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSdks-0001Rt-Rp for submit@debbugs.gnu.org; Tue, 21 Sep 2021 07:16:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSdkr-0001Rm-Oc for submit@debbugs.gnu.org; Tue, 21 Sep 2021 07:16:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSdkr-0005Rv-JI for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 07:16:05 -0400 Original-Received: from mail70c50.megamailservers.eu ([91.136.10.80]:56446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSdko-0004dP-TT for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 07:16:05 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1632222956; bh=77CfuNeGyZuT9bfBo/MSnAr8tS7V9rFPYizXMRRSGoE=; h=From:Subject:Date:To:From; b=bTnsMer1ah8+E8XPi2VD110o+XIaD+gLf3r4fIhSIgfjiRDEWZiydpLDwcQtBD+FJ G4qLZWUTDl7FWCRALhO+2pD3UfimBgrJPxBRwpvW5GIOLe5I2sVxhRLbgz2vUpVSry gGGZfBxiGcvDrMl1agqC4lsYZz2hwq8W7aGNHHOc= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18LBFskC021467 for ; Tue, 21 Sep 2021 11:15:56 +0000 X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F23.6149BEEC.0074, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=ReDzt3hv c=1 sm=1 tr=0 ts=6149beec a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=vtB9HbqcwF9x0TkvSvEA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.80; envelope-from=mattiase@acm.org; helo=mail70c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214951 Archived-At: 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) =3D> hiss ; interpreted =3D> (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)) =3D> #[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)) =3D> #[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.