GNU bug report logs - #37943
assoc-default is wrongly flagged as side-effect-free.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Sun, 27 Oct 2019 12:26:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 37943 <at> debbugs.gnu.org:


Received: (at 37943) by debbugs.gnu.org; 28 Oct 2019 15:24:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 28 11:24:39 2019
Received: from localhost ([127.0.0.1]:46200 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iP6so-0008Sa-QB
	for submit <at> debbugs.gnu.org; Mon, 28 Oct 2019 11:24:38 -0400
Received: from quimby.gnus.org ([80.91.231.51]:42006)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iP6sl-0008SQ-W9
 for 37943 <at> debbugs.gnu.org; Mon, 28 Oct 2019 11:24:36 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1iP6si-0000VB-LV; Mon, 28 Oct 2019 16:24:35 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#37943: assoc-default is wrongly flagged as side-effect-free.
References: <20191027122455.GB27491@ACM>
Date: Mon, 28 Oct 2019 16:24:32 +0100
In-Reply-To: <20191027122455.GB27491@ACM> (Alan Mackenzie's message of "Sun,
 27 Oct 2019 12:24:55 +0000")
Message-ID: <87zhhk99lb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alan Mackenzie <acm@HIDDEN> writes: > In the source for
 assoc-default
 (in subr.el) appears > > (declare (side-effect-free t)) > > . This is not
 true when the TEST argument to assoc-default itself > changes the match-data.
 > > I suggest [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 37943
Cc: 37943 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alan Mackenzie <acm@HIDDEN> writes:

> In the source for assoc-default (in subr.el) appears
>
>     (declare (side-effect-free t))
>
> .  This is not true when the TEST argument to assoc-default itself
> changes the match-data.
>
> I suggest removing this declaration from the function rather than
> amending the code with a save-match-data.  There are calls to
> assoc-default in set-auto-mode where the caller relies on the match data
> set by the function when TEST is string-match.  :-(

Yeah, I don't think any function that takes a closure as an argument
should be marked side-effect free?  The TEST function can side-effect as
much as it wants.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#37943; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Oct 2019 12:25:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 27 08:25:05 2019
Received: from localhost ([127.0.0.1]:41773 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iOhbV-000676-7A
	for submit <at> debbugs.gnu.org; Sun, 27 Oct 2019 08:25:05 -0400
Received: from lists.gnu.org ([209.51.188.17]:48740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1iOhbR-00066c-1a
 for submit <at> debbugs.gnu.org; Sun, 27 Oct 2019 08:25:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53754)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <acm@HIDDEN>) id 1iOhbQ-0004PH-1p
 for bug-gnu-emacs@HIDDEN; Sun, 27 Oct 2019 08:25:00 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1iOhbP-0005kI-0Y
 for bug-gnu-emacs@HIDDEN; Sun, 27 Oct 2019 08:24:59 -0400
Received: from colin.muc.de ([193.149.48.1]:26985 helo=mail.muc.de)
 by eggs.gnu.org with smtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1iOhbO-0005ih-MY
 for bug-gnu-emacs@HIDDEN; Sun, 27 Oct 2019 08:24:58 -0400
Received: (qmail 23553 invoked by uid 3782); 27 Oct 2019 12:24:56 -0000
Received: from acm.muc.de (p2E5D5E17.dip0.t-ipconnect.de [46.93.94.23]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 27 Oct 2019 13:24:55 +0100
Received: (qmail 28041 invoked by uid 1000); 27 Oct 2019 12:24:55 -0000
Date: Sun, 27 Oct 2019 12:24:55 +0000
To: bug-gnu-emacs@HIDDEN
Subject: assoc-default is wrongly flagged as side-effect-free.
Message-ID: <20191027122455.GB27491@ACM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy]
X-Received-From: 193.149.48.1
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

Hello, Emacs.

Emacs 27.

In the source for assoc-default (in subr.el) appears

    (declare (side-effect-free t))

.  This is not true when the TEST argument to assoc-default itself
changes the match-data.

I suggest removing this declaration from the function rather than
amending the code with a save-match-data.  There are calls to
assoc-default in set-auto-mode where the caller relies on the match data
set by the function when TEST is string-match.  :-(

-- 
Alan Mackenzie (Nuremberg, Germany).




Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#37943; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 28 Oct 2019 15:30:02 UTC

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