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#46256: [feature/native-comp] AOT eln files ignored if run from build tree Date: Fri, 05 Mar 2021 15:52:34 +0200 Message-ID: <83o8fxyafx.fsf@gnu.org> References: <86blch14qt.fsf@gmail.com> <83h7m84h9g.fsf@gnu.org> <86v9ao5czu.fsf@gmail.com> <86wnutogrh.fsf@gmail.com> <86wnut8fb9.fsf@gmail.com> <861rd1tbpa.fsf@gmail.com> <83pn0km6y3.fsf@gnu.org> <86ft1f8ara.fsf@gmail.com> <83sg5cjdn8.fsf@gnu.org> <83r1kwjcy2.fsf@gnu.org> <83k0qoj9zv.fsf@gnu.org> <83im68j963.fsf@gnu.org> <83tuprhur0.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21654"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46256@debbugs.gnu.org, andrewjmoreton@gmail.com To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 05 14:53:09 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 1lIAtB-0005VG-8t for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Mar 2021 14:53:09 +0100 Original-Received: from localhost ([::1]:39280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIAtA-00076c-7V for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Mar 2021 08:53:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIAt4-00076N-HV for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 08:53:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIAt4-0006Cc-AU for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 08:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIAt4-0007gp-5h for bug-gnu-emacs@gnu.org; Fri, 05 Mar 2021 08:53: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: Fri, 05 Mar 2021 13:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46256 X-GNU-PR-Package: emacs Original-Received: via spool by 46256-submit@debbugs.gnu.org id=B46256.161495237929550 (code B ref 46256); Fri, 05 Mar 2021 13:53:02 +0000 Original-Received: (at 46256) by debbugs.gnu.org; 5 Mar 2021 13:52:59 +0000 Original-Received: from localhost ([127.0.0.1]:33297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIAt0-0007gY-IA for submit@debbugs.gnu.org; Fri, 05 Mar 2021 08:52:59 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIAsy-0007gJ-Ms for 46256@debbugs.gnu.org; Fri, 05 Mar 2021 08:52:57 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41338) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIAst-00066I-CM; Fri, 05 Mar 2021 08:52:51 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4093 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lIAss-0004vm-RF; Fri, 05 Mar 2021 08:52:51 -0500 In-Reply-To: (message from Andrea Corallo on Thu, 04 Mar 2021 14:49:47 +0000) 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:201541 Archived-At: > From: Andrea Corallo > Cc: Eli Zaretskii , 46256@debbugs.gnu.org, > andrewjmoreton@gmail.com > Date: Thu, 04 Mar 2021 14:49:47 +0000 > > I've a reproducer that is most luckily due to the same issue you are > observing: > > emacs -batch -l comp -f batch-native-compile .../emacs/lisp/progmodes/cc-engine.el > > GC kicks-in and we end-up marking #, we try then > to mark its compilation unit but we segfault (backtrace below). AFAICT, the crash I see here, while compiling subr-x.el, is not inside GC: gc_in_progress is zero when Emacs crashes. To make debugging easier, I started Emacs like this: emacs -batch -l comp -f batch-byte-native-compile-for-bootstrap ../lisp/emacs-lisp/subr-x.el (AFAIU, using batch-byte-native-compile-for-bootstrap is currently the only way of invoking the native compilation in the same Emacs process, not in an async subprocess, is that right?) It crashes inside comp--compile-ctxt-to-file, and when it does, the C stack seems to be smashed: Thread 1 received signal SIGSEGV, Segmentation fault. 0x06acac3e in ?? () (gdb) bt #0 0x06acac3e in ?? () #1 0x00010101 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Lisp Backtrace: "comp--compile-ctxt-to-file" (0x82ca78) "comp-compile-ctxt-to-file" (0x82cc88) "comp-final1" (0x82cfb0) "comp-final" (0x82d238) "comp--native-compile" (0x82d468) "batch-native-compile" (0x82d6a0) "batch-byte-native-compile-for-bootstrap" (0x82d908) "command-line-1" (0x82e360) "command-line" (0x82ef08) "normal-top-level" (0x82f630) I then put a breakpoint in comp--compile-ctxt-to-file and stepped through it. This behaves erratically: if I just step with "next", it seems to crash inside the call to gcc_jit_context_set_int_option, here: gcc_jit_context_set_int_option (comp.ctxt, GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL, comp.speed < 0 ? 0 : (comp.speed > 3 ? 3 : comp.speed)); But if I "stepi" inside gcc_jit_int_option_optimization_level, it somehow seems to return, proceeds to this line: gcc_jit_context_compile_to_file (comp.ctxt, GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, SSDATA (tmp_file)); Then something goes wrong inside it: the backtrace shows bogus addresses (note the "0xbaadf00d" thingies): 0x0766f180 in ?? () (gdb) bt #0 0x0766f180 in ?? () #1 0x672f756e in ?? () #2 0x652f7469 in ?? () #3 0x7363616d in ?? () #4 0x74616e2f in ?? () #5 0x2d657669 in ?? () #6 0x706d6f63 in ?? () #7 0x74616e2f in ?? () #8 0x2d657669 in ?? () #9 0x7073696c in ?? () #10 0x2e38322f in ?? () #11 0x30352e30 in ?? () #12 0x3238312d in ?? () #13 0x65306335 in ?? () #14 0x75732f32 in ?? () #15 0x782d7262 in ?? () #16 0x6432302d in ?? () #17 0x33666566 in ?? () #18 0x37312d32 in ?? () #19 0x62656166 in ?? () #20 0x47736431 in ?? () #21 0x47305561 in ?? () #22 0x6e6c652e in ?? () #23 0x706d742e in ?? () #24 0xbaadf000 in ?? () #25 0xbaadf00d in ?? () #26 0xbaadf00d in ?? () #27 0xbaadf00d in ?? () #28 0xbaadf00d in ?? () #29 0xbaadf00d in ?? () #30 0xbaadf00d in ?? () #31 0xbaadf00d in ?? () #32 0xbaadf00d in ?? () #33 0xbaadf00d in ?? () #34 0xbaadf00d in ?? () #35 0xbaadf00d in ?? () #36 0xbaadf00d in ?? () #37 0xbaadf00d in ?? () #38 0xbaadf00d in ?? () #39 0xbaadf00d in ?? () #40 0xbaadf00d in ?? () #41 0xbaadf00d in ?? () #42 0xbaadf00d in ?? () #43 0xbaadf00d in ?? () #44 0xbaadf00d in ?? () #45 0xbaadf00d in ?? () #46 0xbaadf00d in ?? () #47 0xbaadf00d in ?? () #48 0xbaadf00d in ?? () #49 0xbaadf00d in ?? () #50 0xbaadf00d in ?? () #51 0xbaadf00d in ?? () #52 0xbaadf00d in ?? () #53 0xbaadf00d in ?? () #54 0xbaadf00d in ?? () #55 0xbaadf00d in ?? () #56 0xbaadf00d in ?? () #57 0xbaadf00d in ?? () #58 0xbaadf00d in ?? () #59 0xbaadf00d in ?? () #60 0xbaadf00d in ?? () #61 0xbaadf00d in ?? () #62 0xbaadf00d in ?? () #63 0xbaadf00d in ?? () #64 0xbaadf00d in ?? () #65 0xbaadf00d in ?? () #66 0xbaadf00d in ?? () #67 0xbaadf00d in ?? () #68 0xbaadf00d in ?? () #69 0xbaadf00d in ?? () #70 0xbaadf00d in ?? () #71 0xbaadf00d in ?? () #72 0xbaadf00d in ?? () #73 0xbaadf00d in ?? () #74 0xbaadf00d in ?? () #75 0xbaadf00d in ?? () #76 0xbaadf00d in ?? () #77 0xbaadf00d in ?? () #78 0xbaadf00d in ?? () #79 0xbaadf00d in ?? () #80 0xbaadf00d in ?? () #81 0xbaadf00d in ?? () #82 0xbaadf00d in ?? () #83 0xbaadf00d in ?? () #84 0xbaadf00d in ?? () #85 0xbaadf00d in ?? () #86 0xbaadf00d in ?? () #87 0xbaadf00d in ?? () #88 0xbaadf00d in ?? () #89 0xbaadf00d in ?? () #90 0xbaadf00d in ?? () #91 0xbaadf00d in ?? () #92 0xbaadf00d in ?? () #93 0xbaadf00d in ?? () #94 0xbaadf00d in ?? () #95 0xbaadf00d in ?? () #96 0xbaadf00d in ?? () #97 0xbaadf00d in ?? () #98 0xbaadf00d in ?? () #99 0xbaadf00d in ?? () #100 0xbaadf00d in ?? () #101 0xbaadf00d in ?? () #102 0xbaadf00d in ?? () #103 0xbaadf00d in ?? () #104 0xbaadf00d in ?? () #105 0xbaadf00d in ?? () #106 0xbaadf00d in ?? () #107 0xbaadf00d in ?? () #108 0xbaadf00d in ?? () #109 0xbaadf00d in ?? () #110 0xbaadf00d in ?? () #111 0xbaadf00d in ?? () #112 0xbaadf00d in ?? () #113 0xbaadf00d in ?? () #114 0xbaadf00d in ?? () #115 0xbaadf00d in ?? () #116 0xbaadf00d in ?? () #117 0xbaadf00d in ?? () #118 0xbaadf00d in ?? () #119 0xbaadf00d in ?? () #120 0xbaadf00d in ?? () #121 0xbaadf00d in ?? () #122 0xbaadf00d in ?? () #123 0xbaadf00d in ?? () #124 0xbaadf00d in ?? () #125 0xbaadf00d in ?? () #126 0xbaadf00d in ?? () #127 0xbaadf00d in ?? () #128 0xbaadf00d in ?? () #129 0xbaadf00d in ?? () #130 0xbaadf00d in ?? () #131 0xbaadf00d in ?? () #132 0xbaadf00d in ?? () #133 0xbaadf00d in ?? () #134 0xbaadf00d in ?? () #135 0xbaadf00d in ?? () #136 0xbaadf00d in ?? () #137 0xbaadf00d in ?? () #138 0xbaadf00d in ?? () #139 0xbaadf00d in ?? () #140 0xbaadf00d in ?? () #141 0xbaadf00d in ?? () #142 0xbaadf00d in ?? () #143 0xbaadf00d in ?? () #144 0xbaadf00d in ?? () #145 0xbaadf00d in ?? () #146 0xbaadf00d in ?? () #147 0xbaadf00d in ?? () #148 0xbaadf00d in ?? () #149 0xbaadf00d in ?? () #150 0xbaadf00d in ?? () #151 0xbaadf00d in ?? () #152 0xbaadf00d in ?? () #153 0xbaadf00d in ?? () #154 0xbaadf00d in ?? () #155 0xbaadf00d in ?? () #156 0xbaadf00d in ?? () #157 0xbaadf00d in ?? () #158 0xbaadf00d in ?? () #159 0xbaadf00d in ?? () #160 0xbaadf00d in ?? () #161 0xbaadf00d in ?? () #162 0xbaadf00d in ?? () #163 0xbaadf00d in ?? () #164 0xbaadf00d in ?? () #165 0xbaadf00d in ?? () #166 0xbaadf00d in ?? () #167 0xbaadf00d in ?? () #168 0xbaadf00d in ?? () #169 0xbaadf00d in ?? () #170 0xbaadf00d in ?? () #171 0xbaadf00d in ?? () #172 0xbaadf00d in ?? () #173 0xbaadf00d in ?? () #174 0xbaadf00d in ?? () #175 0xbaadf00d in ?? () #176 0xbaadf00d in ?? () #177 0xbaadf00d in ?? () #178 0xbaadf00d in ?? () #179 0xbaadf00d in ?? () #180 0xbaadf00d in ?? () #181 0xbaadf00d in ?? () #182 0xbaadf00d in ?? () #183 0xbaadf00d in ?? () #184 0xbaadf00d in ?? () #185 0xbaadf00d in ?? () #186 0xbaadf00d in ?? () #187 0xbaadf00d in ?? () #188 0xbaadf00d in ?? () #189 0xbaadf00d in ?? () #190 0xbaadf00d in ?? () #191 0xbaadf00d in ?? () #192 0xbaadf00d in ?? () #193 0xbaadf00d in ?? () #194 0xbaadf00d in ?? () #195 0xbaadf00d in ?? () #196 0xbaadf00d in ?? () #197 0xbaadf00d in ?? () #198 0xbaadf00d in ?? () #199 0xbaadf00d in ?? () #200 0xbaadf00d in ?? () #201 0xbaadf00d in ?? () #202 0xbaadf00d in ?? () #203 0xbaadf00d in ?? () #204 0xbaadf00d in ?? () #205 0xbaadf00d in ?? () #206 0xbaadf00d in ?? () #207 0xbaadf00d in ?? () #208 0xbaadf00d in ?? () #209 0xbaadf00d in ?? () #210 0xbaadf00d in ?? () #211 0xbaadf00d in ?? () #212 0xbaadf00d in ?? () #213 0xbaadf00d in ?? () #214 0xbaadf00d in ?? () #215 0xbaadf00d in ?? () #216 0xbaadf00d in ?? () #217 0xbaadf00d in ?? () #218 0xbaadf00d in ?? () #219 0xbaadf00d in ?? () #220 0xbaadf00d in ?? () #221 0xbaadf00d in ?? () #222 0xbaadf00d in ?? () #223 0xbaadf00d in ?? () #224 0xbaadf00d in ?? () #225 0xbaadf00d in ?? () #226 0xbaadf00d in ?? () #227 0xbaadf00d in ?? () #228 0xbaadf00d in ?? () #229 0xbaadf00d in ?? () #230 0xbaadf00d in ?? () #231 0xbaadf00d in ?? () #232 0xabababab in ?? () #233 0xabababab in ?? () #234 0xfeeefeee in ?? () #235 0x00000000 in ?? () Maybe if I "stepi" inside that last libgccjit function, I will be able to advance more. But something is definitely fishy here, and I'm not sure what that is. Ideas for further debugging are welcome.