From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#5728: Byte compile doesn't work right on macro Date: Thu, 08 Apr 2010 16:02:55 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1270760492 19564 80.91.229.12 (8 Apr 2010 21:01:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Apr 2010 21:01:32 +0000 (UTC) Cc: 5728@debbugs.gnu.org To: Tom Breton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 08 23:01:25 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nzyqq-00020o-LA for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Apr 2010 23:01:24 +0200 Original-Received: from localhost ([127.0.0.1]:46076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nzyqq-0007aV-6N for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Apr 2010 17:01:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzyLC-000409-KC for bug-gnu-emacs@gnu.org; Thu, 08 Apr 2010 16:28:42 -0400 Original-Received: from [140.186.70.92] (port=60702 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzyLA-0003zH-TD for bug-gnu-emacs@gnu.org; Thu, 08 Apr 2010 16:28:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzyL6-0005tM-B3 for bug-gnu-emacs@gnu.org; Thu, 08 Apr 2010 16:28:40 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57250) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzyL6-0005sz-8U for bug-gnu-emacs@gnu.org; Thu, 08 Apr 2010 16:28:36 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NzxxJ-00073v-R1; Thu, 08 Apr 2010 16:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Apr 2010 20:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5728 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5728-submit@debbugs.gnu.org id=B5728.127075698827135 (code B ref 5728); Thu, 08 Apr 2010 20:04:01 +0000 Original-Received: (at 5728) by debbugs.gnu.org; 8 Apr 2010 20:03:08 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzxwS-00073c-IV for submit@debbugs.gnu.org; Thu, 08 Apr 2010 16:03:08 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzxwP-00073H-Lk for 5728@debbugs.gnu.org; Thu, 08 Apr 2010 16:03:06 -0400 Original-Received: from ceviche.home (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o38K2vpA001255; Thu, 8 Apr 2010 16:02:57 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 3259FB408D; Thu, 8 Apr 2010 16:02:55 -0400 (EDT) In-Reply-To: (Tom Breton's message of "Mon, 15 Mar 2010 22:25:51 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3509=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 08 Apr 2010 16:04:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36101 Archived-At: > When I byte-compile certain code, the results are different than when > it's not byte-compiled. It seems to wrongly merge lists. The one > unusual thing I was doing with the code is using a macro to generate a > call to a ctor (as generated by defstruct) You're victim of a form of "name capture". E.g. if you rename `a' to `b' in BUG3, the bug disappears. And if you macroexpand by hand the call to BUG:make-form the bug is still there. More to the point, the bug is in the compiler-macro for BUG:make-structure: ELISP> (compiler-macroexpand '(BUG:make-structure :edits (cons (car a) (BUG:structure->edits cand)) :a nil)) (block BUG:make-structure (vector 'cl-struct-BUG:structure (cons (car nil) (BUG:structure->edits cand)) nil)) ELISP> (defsubst* toto (a1 a2) (+ a1 a2)) toto ELISP> (compiler-macroexpand '(toto a2 nil)) (block toto (+ nil nil)) ELISP> The problem is that cl-defsubst-expand does the substitution "a1 -> a2 and a2 -> nil" one after the other rather than simultaneously. I've just installed a fix for it in the emacs-23 branch. Stefan