From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#47049: [feature/native] macro-expansion cycle when compiling comp.el Date: Fri, 12 Mar 2021 20:55:20 +0000 Message-ID: References: <83zgzbnm7i.fsf@gnu.org> <83pn07nfuc.fsf@gnu.org> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35646"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: eliz@gnu.org, monnier@iro.umontreal.ca To: 47049@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 12 21:56:12 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 1lKopP-000997-9g for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Mar 2021 21:56:11 +0100 Original-Received: from localhost ([::1]:59812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKopO-0007s9-BC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Mar 2021 15:56:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKopG-0007rg-8C for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2021 15:56:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKopF-00036g-VE for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2021 15:56:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lKopF-0002AL-SK for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2021 15:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Mar 2021 20:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47049 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Eli Zaretskii , 47049@debbugs.gnu.org, Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.16155825388291 (code B ref -1); Fri, 12 Mar 2021 20:56:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Mar 2021 20:55:38 +0000 Original-Received: from localhost ([127.0.0.1]:58529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKoos-00029f-9d for submit@debbugs.gnu.org; Fri, 12 Mar 2021 15:55:38 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKooq-00029Y-KA for submit@debbugs.gnu.org; Fri, 12 Mar 2021 15:55:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKooq-0007Yk-Bf for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2021 15:55:36 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:64144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKook-0002nk-N0; Fri, 12 Mar 2021 15:55:36 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 12CKtK9H005214 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Fri, 12 Mar 2021 20:55:21 GMT In-Reply-To: (Andrea Corallo via's message of "Fri, 12 Mar 2021 20:02:25 +0000") Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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:202207 Archived-At: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Stefan Monnier writes: > >>>> > I made some local modifications in comp.el, and used that modified >>>> > comp.el for a while (by loading it manually at run time) to debug some >>>> > problem. Then I undid those local modifications of comp.el (by saying >>>> > "git checkout") and said "make" to rebuild Emacs. And I see this: >>>> > >>>> > ELC emacs-lisp/comp.elc >>>> > Warning: Eager macro-expansion skipped due to cycle: >>>> > => (load "comp.el") => (macroexpand-all (defalias 'comp-add-call-cstr )) => (macroexpand (comp-loop-insn-in-block )) => (load "comp.el") >>>> > >>>> > Why does this happen? >>>> >>>> I'm not sure, but I can reproduce it. >>>> >>>> I guess (just a guess) it might be because `comp-add-call-cstr' is using >>>> a macro `comp-loop-insn-in-block' that is expanding with a >>>> `cl-symbol-macrolet' inside? (no idea why this should be a problem). >>>> >>>> > could it be that while comp.el was modified it >>>> > got native-compiled, and now that inconsistent comp.eln gets in the >>>> > way? >>>> >>>> I think this has not to do specifically with native compilation. >>>> >>>> I see it goes away removing '(setq load-prefer-newer t)' from the >>>> invocation tho. >>>> >>>> Perhaps somebody already more into the macro expansion business might >>>> have some suggestion. >>> >>> Stefan, can you help, please? >> >> Nothing jumps at me by looking at the code. I'll have to look at the >> actual complete stacktrace I think. > > Cool didn't know was so easy to generate backtraces to debug this kind > of issues. At the bottom I attached the backtrace I produced and had a > look into. > > IIUC while *loading* "comp.el" we try to advice `macroexpand' and > consequentially we try to install a trampoline (was already compiled) > for `macroexpand', this is supposed to be done by > `comp-subr-trampoline-install' requiring "comp.el" to be loaded again! > > Assuming my analysis is correct I'm not sure what's the best work around > for this condition. WDYT? Apparently moving the definition of `comp-subr-trampoline-install' before the other code in comp.el solves the issue. Not sure if is the best way to fix this tho. Andrea