From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: bignum branch Date: Tue, 14 Aug 2018 00:13:54 +0100 Message-ID: <86va8d3ln1.fsf@gmail.com> References: <87o9fbbw1t.fsf@tromey.com> <86k1ozl0yd.fsf@gmail.com> <83in4iojva.fsf@gnu.org> <86bmaasm39.fsf@gmail.com> <83a7puo8oq.fsf@gnu.org> <83zhxummef.fsf@gnu.org> <83lg9em1v6.fsf@gnu.org> <86r2j5q67t.fsf@gmail.com> <83r2j4lvyo.fsf@gnu.org> <86va8gj12l.fsf@gmail.com> <83k1owlscr.fsf@gnu.org> <86mutsiy80.fsf@gmail.com> <83eff4lqon.fsf@gnu.org> <86eff4ixcj.fsf@gmail.com> <83a7pslnzz.fsf@gnu.org> <86eff4turj.fsf@gmail.com> <83y3dbju00.fsf@gnu.org> <86ftzjs73w.fsf@gmail.com> <83pnymjomm.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1534201962 22571 195.159.176.226 (13 Aug 2018 23:12:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Aug 2018 23:12:42 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 14 01:12:38 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpM0s-0005nA-0f for ged-emacs-devel@m.gmane.org; Tue, 14 Aug 2018 01:12:38 +0200 Original-Received: from localhost ([::1]:41755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpM2y-0002gS-L4 for ged-emacs-devel@m.gmane.org; Mon, 13 Aug 2018 19:14:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpM2L-0002gA-F7 for emacs-devel@gnu.org; Mon, 13 Aug 2018 19:14:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpM2H-0000oo-9B for emacs-devel@gnu.org; Mon, 13 Aug 2018 19:14:09 -0400 Original-Received: from [195.159.176.226] (port=46571 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fpM2H-0000oO-2K for emacs-devel@gnu.org; Mon, 13 Aug 2018 19:14:05 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fpM07-0004ve-Mv for emacs-devel@gnu.org; Tue, 14 Aug 2018 01:11:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 89 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:hqyzONIlYhKadmcHlrDZuRxGFDI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228505 Archived-At: On Mon 13 Aug 2018, Eli Zaretskii wrote: >> From: Andy Moreton >> Date: Sun, 12 Aug 2018 20:44:03 +0100 >> >> gdb: Target exception EXCEPTION_SINGLE_STEP at 0x40016c304 >> gdb: Target exception EXCEPTION_SINGLE_STEP at 0x46ace5dc0 >> 0x000000046ace5dc0 in ?? () >> (gdb) >> Cannot find bounds of current function >> (gdb) stepi >> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x46ace5dc0 >> >> Thread 1 received signal SIGSEGV, Segmentation fault. >> 0x000000046ace5dc0 in ?? () > > Hmm... and what does this say? > > (gdb) x/i 0x000000046ace5dc0 This is a different binary (master rebuilt from commit eb787d749f28), but eh address are the same: (gdb) s __gmpz_popcount (__gmp_u=0x400c2e688 ) at C:/msys64/mingw64/include/gmp.h:1844 1844 if (__GMP_LIKELY (__gmp_usize > 0)) (gdb) 1845 __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize); (gdb) 0x000000046ace5dc0 in ?? () (gdb) x/i 0x000000046ace5dc0 => 0x46ace5dc0: Cannot access memory at address 0x46ace5dc0 (gdb) Undefined command: "". Try "help". (gdb) x/i 0x000000006ace5dc0 0x6ace5dc0: push %rdi (gdb) > > This address looks bogus to me. Earlier, you reported: > >> Thread 1 received signal SIGSEGV, Segmentation fault. >> 0x000000046ace5dc0 in ?? () >> (gdb) p mpn_popcount >> $5 = {} 0x401e61484 <__imp___gmpn_popcount> >> (gdb) x/xg mpn_popcount >> 0x401e61484 <__imp___gmpn_popcount>: 0x000000006ace5dc0 >> (gdb) disas 0x000000006ace5dc0,+0x80 > > I think your disassembly used the wrong address, it should have used > this: > > (gdb) disas 0x401e61484,+0x80 > > I'd expect to see an indirect jump there. Agreed. > And notice how 0x000000006ace5dc0, the value at __imp___gmpn_popcount, > and 0x000000046ace5dc0, where Emacs crashed, are the same value, up to > the 0x0000000400000000 bit. Hmm... And notice that 0x0000000400000000 is the image base of emacs.exe: ..mingw64-x86_64/src> objdump -x emacs.exe | grep ^ImageBase ImageBase 0000000400000000 This is almost as if it has assumed that __gmpn_popcount is a function from the text of emacs.exe rather than from libgmp-10.dll. > Feel free to change the program as you see fit. I hoped that we will > have a small enough test case to report to GCC and GMP developers. If > not, maybe it's worth to report to the GMP list anyway, they could > have some ideas. I have made some attempts to reproduce that bad behaviour, but so far without success. I'll report back if I make more progress. > It may also be a good idea to report the problem with gmp.h to the > MSYS2 forum, they should fix the header anyway. (Mingw.org already > fixed theirs, as I reported related problems, not about Emacs, a few > months ago.) Looking at the MSYS2 on github, there was a pull request to fix the broken header install problem for GMP, but the maintainers dropped it: AndyM