GNU bug report logs -
#58601
29.0.50; Infinite loop in byte-compile--first-symbol-with-pos
Previous Next
Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Mon, 17 Oct 2022 23:25:01 UTC
Severity: normal
Found in version 29.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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).
This bug report was last modified 2 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.