From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67900: 30.0.50; Emacs Crahes When Executing Command `consult-buffer' Date: Wed, 20 Dec 2023 15:10:21 +0200 Message-ID: <83plz1ggua.fsf@gnu.org> References: <838r5qib7l.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13999"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67900@debbugs.gnu.org To: Chang Xiaoduan , Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 20 14:12:15 2023 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 1rFwMw-0003Rp-Ef for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Dec 2023 14:12:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFwMk-0006oe-1k; Wed, 20 Dec 2023 08:12:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFwMh-0006nk-Fj for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2023 08:11:59 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFwMh-0005Rf-6J for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2023 08:11:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rFwMk-0003SV-4q for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2023 08:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Dec 2023 13:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67900 X-GNU-PR-Package: emacs Original-Received: via spool by 67900-submit@debbugs.gnu.org id=B67900.170307787113183 (code B ref 67900); Wed, 20 Dec 2023 13:12:02 +0000 Original-Received: (at 67900) by debbugs.gnu.org; 20 Dec 2023 13:11:11 +0000 Original-Received: from localhost ([127.0.0.1]:38871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFwLt-0003QY-Ub for submit@debbugs.gnu.org; Wed, 20 Dec 2023 08:11:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFwLp-0003Pz-EG for 67900@debbugs.gnu.org; Wed, 20 Dec 2023 08:11:08 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFwLb-0004Dl-3u; Wed, 20 Dec 2023 08:10:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VsLLX8xPdbZxSEu2BEHUtEOOSGjXIA8eH6otVNGnpTo=; b=qQ2HHK45igcq vlVKBadmUf2KXO4lQGfc6Fo9vIIV6Q7aa5FgG1vaaB825lE7v6ozFq2IGePxuhqjAYTlMUCs1hvZ+ wkPd1RPMATfVRA8bND+iU/vjEsVOd/uquUekYNfOFcZi8u8IXb/ug9kQE1T2oihBxyI2jD1UarfsA 7Z3I6wcIlBv6Nn8/mIXsN3m7V+3c8V7O4Jga9MJ4nuiD7iWXQA+E/ynPvT32z70ifVMsacMzcWIqh N5vfrBkBZYr2grpUpG8tU/JhwdoyhCz4J36pKtrpLK0deRarMq67Sgn3WiL7ocBFrcz3iWJcVNnAc gJXLiyd8aB95L+VPXjq/Bg==; In-Reply-To: (message from Chang Xiaoduan on Wed, 20 Dec 2023 14:37:30 +0800) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276560 Archived-At: [Please use Reply All to reply, to keep the bug tracker CC'ed.] > From: Chang Xiaoduan > Date: Wed, 20 Dec 2023 14:37:30 +0800 > > Hello Eli, > > Eli Zaretskii writes: > > > We need a reproducible recipe, starting from "emacs -Q", to reproduce > > the problem, so we could debug it here and find the reason(s). Can > > you please provide such a recipe? It is okay to include in the recipe > > commands that load add-on packages, as long as you clearly tell where > > to get those packages and how to load them. > > > > Thanks. > > I have tried my best but what I found at best is an unreliable > reproducible recipe. > > Start Emacs with `emacs -Q` then evaluate the following expressions one > by one: > > ``` > (require 'package) > (setq package-archives > '( > ("gnu" . "https://elpa.gnu.org/packages/") > ("melpa" . "https://melpa.org/packages/") > ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) > (unless (package-installed-p 'use-package) > (package-install 'use-package)) > (require 'use-package) > (setq use-package-always-ensure t) > > (use-package consult) > ``` > > After you have evaluated `(use-package consult)`, you may experience a > crash when Emacs is compiling its code. The backtrace for this crash: > > ``` > (gdb) bt > #0 0x00007ff80ad7b3b3 in KERNELBASE!DebugBreak () from C:\Windows\System32\KernelBase.dll > #1 0x00007ff6b2f58778 in emacs_abort () at ../../src/w32fns.c:11177 > #2 0x00007ff6b2e22119 in terminate_due_to_signal (sig=11, backtrace_limit=) at ../../src/emacs.c:484 > #3 0x00007ff6b2e44519 in deliver_fatal_thread_signal () at ../../src/sysdep.c:1811 > #4 0x00007ff6b2fbd972 in _gnu_exception_handler (exception_data=0x694ddfbd40) at C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:213 > #5 0x00007ff80c507ff8 in msvcrt!__C_specific_handler () from C:\Windows\System32\msvcrt.dll > #6 0x00007ff80d6523df in ntdll!.chkstk () from C:\Windows\SYSTEM32\ntdll.dll > #7 0x00007ff80d6014a4 in ntdll!RtlRaiseException () from C:\Windows\SYSTEM32\ntdll.dll > #8 0x00007ff80d650f0e in ntdll!KiUserExceptionDispatcher () from C:\Windows\SYSTEM32\ntdll.dll > #9 0x00007ff6b2edc652 in XBARE_SYMBOL (a=) at ../../src/lisp.h:1152 > #10 XSYMBOL (a=) at ../../src/lisp.h:1161 > #11 SYMBOL_NAME (sym=) at ../../src/lisp.h:2335 > #12 print_object (obj=, obj@entry=0x193c854e520, printcharfun=0x0, escapeflag=true) at ../../src/print.c:2413 > #13 0x00007ff6b2edec06 in print (obj=obj@entry=0x193c854e520, printcharfun=, escapeflag=escapeflag@entry=true) > at ../../src/print.c:1301 > #14 0x00007ff6b2eded28 in Fprin1 (object=0x193c854e520, printcharfun=printcharfun@entry=0x193c3a6b8bd, overrides=overrides@entry=0x0) > at ../../src/print.c:776 > #15 0x00007ff6b2edf36b in print_error_message (data=, stream=0x193c3a6b8bd, context=context@entry=0x0, caller=caller@entry=0x0) > at ../../src/print.c:1134 > #16 0x00007ff6b2edf5a2 in Ferror_message_string (obj=) at ../../src/print.c:1038 > #17 0x00007fff9fc37d61 in F627974652d636f6d70696c652d7265706f72742d6572726f72_byte_compile_report_error_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln > #18 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfd818) at ../../src/eval.c:3016 > #19 0x00007fff9fc3f56a in F627974652d636f6d70696c652d66726f6d2d627566666572_byte_compile_from_buffer_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln > #20 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfd980) at ../../src/eval.c:3016 > #21 0x00007fff9fc3d784 in F627974652d636f6d70696c652d66696c65_byte_compile_file_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln > #22 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfdaa0) at ../../src/eval.c:3016 > #23 0x00007fff9fc3c60b in F627974652d7265636f6d70696c652d66696c65_byte_recompile_file_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln > #24 0x00007ff6b2f00d97 in exec_byte_code (fun=, args_template=, nargs=, nargs@entry=1734276455720, > args=, args@entry=0xa0000694ddfdd08) at ../../src/lisp.h:2210 > #25 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0xa0000694ddfdd08, nargs=1734276455720, args_template=, fun=) > at ../../src/eval.c:3102 > #26 0x00007ff6b2eb8fa6 in funcall_general (fun=, numargs=numargs@entry=0, args=args@entry=0x694ddfdd08) at ../../src/eval.c:2978 > #27 0x00007ff6b2eb3952 in Ffuncall (nargs=1, args=0x694ddfdd00) at ../../src/eval.c:3016 > #28 0x00007fff9fc3c513 in F627974652d7265636f6d70696c652d6469726563746f7279_byte_recompile_directory_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln > #29 0x00007ff6b2f00d97 in exec_byte_code (fun=, args_template=, nargs=, nargs@entry=1734174478760, > args=, args@entry=0x610000694ddfdec8) at ../../src/lisp.h:2210 > #30 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0x610000694ddfdec8, nargs=1734174478760, args_template=, fun=) > at ../../src/eval.c:3102 > #31 0x00007ff6b2eb8fa6 in funcall_general (fun=, numargs=numargs@entry=1, args=args@entry=0x694ddfdec8) at ../../src/eval.c:2978 > #32 0x00007ff6b2eb3952 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x694ddfdec0) at ../../src/eval.c:3016 > #33 0x00007ff6b2ec2077 in call1 (arg1=, fn=0xffff819d10e34f20) at ../../src/lisp.h:3248 > #34 mapcar1 (leni=2, vals=vals@entry=0x0, fn=fn@entry=0xffff819d10e34f20, seq=seq@entry=0x193c872b613) at ../../src/fns.c:3044 > #35 0x00007ff6b2ec475c in Fmapc (function=0xffff819d10e34f20, sequence=0x193c872b613) at ../../src/fns.c:3181 > #36 0x00007ff6b2f00d97 in exec_byte_code (fun=, fun@entry=0x11aa1220, args_template=, nargs=, > nargs@entry=1734174522728, args=, args@entry=0xfc0000694ddfe040) at ../../src/lisp.h:2210 > #37 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0xfc0000694ddfe040, nargs=1734174522728, args_template=, fun=0x11aa1220) > at ../../src/eval.c:3102 > #38 0x00007ff6b2eb92ae in apply_lambda (fun=0x11aa1220, fun@entry=0x193c4d59e65, args=, count=..., count@entry=...) > at ../../src/eval.c:3124 > #39 0x00007ff6b2eb7544 in eval_sub (form=) at ../../src/eval.c:2609 > #40 0x00007ff6b2ee08d5 in readevalloop_eager_expand_eval (val=, macroexpand=macroexpand@entry=0xffff819d10183120) > at ../../src/lread.c:2411 > #41 0x00007ff6b2ee07dc in readevalloop_eager_expand_eval (val=0x0, val@entry=0x193c4f123e3, macroexpand=macroexpand@entry=0xffff819d10183120) > at ../../src/lisp.h:1498 > #42 0x00007ff6b2ee8fde in readevalloop (readcharfun=readcharfun@entry=0x193c4e3e335, infile0=infile0@entry=0x0, > sourcename=sourcename@entry=0x193c430c534, printflag=printflag@entry=false, unibyte=unibyte@entry=0x0, readfun=readfun@entry=0x0, > start=start@entry=0x0, end=, end@entry=0x0) at ../../src/lread.c:2595 > #43 0x00007ff6b2eea37f in Feval_buffer (buffer=, printflag=0x0, filename=0x193c430c534, unibyte=0x0, do_allow_print=0x30) > at ../../src/lread.c:2668 > #44 0x00007fffee1727ed in F6c6f61642d776974682d636f64652d636f6e76657273696f6e_load_with_code_conversion_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\mule-3352613d-5a32cafd.eln > #45 0x00007ff6b2eb7166 in funcall_subr (subr=, numargs=numargs@entry=4, args=args@entry=0x694ddfe918) at ../../src/eval.c:3063 > #46 0x00007ff6b2eb8f20 in funcall_general (fun=, numargs=numargs@entry=4, args=args@entry=0x694ddfe918) at ../../src/eval.c:2962 > #47 0x00007ff6b2eb3952 in Ffuncall (nargs=nargs@entry=5, args=args@entry=0x694ddfe910) at ../../src/eval.c:3016 > #48 0x00007ff6b2ee971c in call4 (arg4=0x30, arg3=0x30, arg2=0x193c430c534, arg1=, fn=) at ../../src/lisp.h:3270 > #49 Fload (file=0x193c430c6b4, noerror=, nomessage=0xffff819d0ff38f08, nosuffix=, must_suffix=) > at ../../src/lread.c:1680 > #50 0x00007ff6b2eb7166 in funcall_subr (subr=, numargs=numargs@entry=3, args=args@entry=0x694ddfed50) at ../../src/eval.c:3063 > #51 0x00007ff6b2eb8f20 in funcall_general (fun=, numargs=numargs@entry=3, args=args@entry=0x694ddfed50) at ../../src/eval.c:2962 > #52 0x00007ff6b2eb3952 in Ffuncall (nargs=4, args=0x694ddfed48) at ../../src/eval.c:3016 > #53 0x00007fffee1b528c in F737461727475702d2d6c6f61642d757365722d696e69742d66696c65_startup__load_user_init_file_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln > #54 0x00007ff6b2eb3952 in Ffuncall (nargs=4, args=0x694ddfee80) at ../../src/eval.c:3016 > #55 0x00007fffee1b72f9 in F636f6d6d616e642d6c696e65_command_line_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln > #56 0x00007ff6b2eb3952 in Ffuncall (nargs=1, args=0x694ddfefa8) at ../../src/eval.c:3016 > #57 0x00007fffee1b34e0 in F6e6f726d616c2d746f702d6c6576656c_normal_top_level_0 () > from d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln > #58 0x00007ff6b2eb7b89 in eval_sub (form=form@entry=0x193c38d4903) at ../../src/eval.c:2516 > #59 0x00007ff6b2eba2c2 in Feval (form=0x193c38d4903, lexical=) at ../../src/eval.c:2383 > #60 0x00007ff6b2eb1f6d in internal_condition_case (bfun=bfun@entry=0x7ff6b2e22a30 , handlers=handlers@entry=0x90, > hfun=hfun@entry=0x7ff6b2e2c060 ) at ../../src/eval.c:1486 > #61 0x00007ff6b2e2353d in top_level_1 (ignore=) at ../../src/keyboard.c:1174 > #62 0x00007ff6b2eb1edb in internal_catch (tag=tag@entry=0x10fb0, func=func@entry=0x7ff6b2e23510 , arg=arg@entry=0x0) > at ../../src/eval.c:1209 > #63 0x00007ff6b2e22965 in command_loop () at ../../src/keyboard.c:1134 > #64 0x0000000000000000 in ?? () > ``` > > This crash does not occur every time the consult package is installed, > you may have to try multiple times to reproduce it. Remember to delete > all isntalled packages and eln-caches before you try again. > > After the consult package is installed, `M-x consult-buffer` may trigger > the crash I mentioned in the last E-mail. However, this one is also not > reproducible every time the command is executed. You may restart Emacs > and try again. If you have restarted several times and the crash still > not present itself, then you may have to reinstall the pacakge. > > Another thing worth noting is that, when I expericen such a crash, if I > delete the eln-cache for the consult package. Then the next time I start > Emacs and execute `conult-buffer`, Emacs never crashes. However, it > generates the eln-cache for that package. If I restart Emacs after that, > it is likely to crash when I execute `consult-buffer`. I think the crash > is related with the eln-cache, which also explains why there is no elisp > error but a crash. I hope this information could be helpful, but you may > have alredy figured it out. > > If you still can't reprocude the crash, please tell me if there is > anything else I can do to help. The above seems to indicate the problems are somehow related to native compilation. Can you build Emacs without native-compilation, and try reproducing this in such an Emacs? If the problem doesn't happen in Emacs without native-compilation, I suspect this is a MinGW GCC bug, not an Emacs bug: the native code in *.eln files is somehow invalid. Which version of GCC do you have installed, and is libgccjit you have is from the same GCC version? Or maybe we have a bug in native compilation. Andrea, can you try reproducing this on GNU/Linux? Another idea is to modify comp.el to have native-comp-speed default to 1 instead of 2, then rebuild Emacs ("make bootstrap") with CFLAGS='-O1', and see if the problem goes away. If it does, that again points toward GCC/libgccjit and the compiler optimizations.