From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#58601: 29.0.50; Infinite loop in byte-compile--first-symbol-with-pos Date: Tue, 18 Oct 2022 15:01:49 +0000 Message-ID: References: <8735bm6nl9.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38618"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 58601@debbugs.gnu.org, Stefan Monnier To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 18 17:05:06 2022 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 1oko9R-0009nu-WC for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 17:05:05 +0200 Original-Received: from localhost ([::1]:38996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oko9Q-0003Sg-Bd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 11:05:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oko7U-0003OQ-P8 for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 11:03:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oko7S-0003wH-7Y for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 11:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oko7R-0007Ig-Sx for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 11:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Oct 2022 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58601 X-GNU-PR-Package: emacs Original-Received: via spool by 58601-submit@debbugs.gnu.org id=B58601.166610532527989 (code B ref 58601); Tue, 18 Oct 2022 15:03:01 +0000 Original-Received: (at 58601) by debbugs.gnu.org; 18 Oct 2022 15:02:05 +0000 Original-Received: from localhost ([127.0.0.1]:53750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oko6W-0007HN-Vk for submit@debbugs.gnu.org; Tue, 18 Oct 2022 11:02:05 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:26985) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oko6R-0007GM-Ia for 58601@debbugs.gnu.org; Tue, 18 Oct 2022 11:02:03 -0400 Original-Received: (qmail 7364 invoked by uid 3782); 18 Oct 2022 17:01:51 +0200 Original-Received: from acm.muc.de (p4fe15b73.dip0.t-ipconnect.de [79.225.91.115]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 18 Oct 2022 17:01:51 +0200 Original-Received: (qmail 8269 invoked by uid 1000); 18 Oct 2022 15:01:49 -0000 Content-Disposition: inline In-Reply-To: <8735bm6nl9.fsf@tcd.ie> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:245806 Archived-At: Hello, Basil. On Tue, Oct 18, 2022 at 02:24:02 +0300, Basil L. Contovounesios wrote: > Given this sample input file: [ .... ] > Byte-compiling it as follows hangs indefinitely: > emacs -Q -batch -f batch-byte-compile my.el > While it's hanging, might as well poke it: > pkill -f 'batch-byte-compile my\.el' -SIGUSR2 > To which it yields the following backtrace: [ .... ] > I.e. the 'pure' compile-time form has a cycle, and the DFS of > byte-compile--first-symbol-with-pos gets lost. What's a DFS? > Paraphrasing Stefan, it's acceptable if the compiler mishandles > circular source code, but it should be able to handle circular data. The problem here seems to be feeding macroexp-warn-and-return with data as the FORM argument. FORM is intended only to be an executable lisp form. The doc string, perhaps, could be clearer on this. > I don't know why, but I can reproduce the hang only when the form is inside > ert-deftest+should, and not inside a plain defun. There is a huge concentration of "advanced" features inside those ~20 lines of Lisp code. There's eval-and-compile, nconc, a compiler-macro, and ert. ;-) > Perhaps byte-compile--first-symbol-with-pos needs to employ something > like byte-run--ssp-seen? Or does ERT somehow come into play? It wouldn't be difficult, just tedious, to add checking for circular lists into byte-compile--first-symbol-with-pos. But a circular list is an invalid argument for FORM in macorexp-warn-and-return, see above. There are surely lots of places in Emacs where feeding a circular list as an argument to a function will cause a hang. At the moment, I'm not in favour of doing anything here. I don't think there's a bug. > Thanks, > -- > Basil -- Alan Mackenzie (Nuremberg, Germany).