emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bignum branch


From: Eli Zaretskii
Subject: Re: bignum branch
Date: Sun, 12 Aug 2018 21:54:23 +0300

> From: Andy Moreton <address@hidden>
> Date: Sat, 11 Aug 2018 23:15:28 +0100
> 
> As Tom has completed merging to master, I have switched to the master
> branch and rebuilt from a clean tree (after "git clean -Xdf").
> 
> Stepping through the code in gdb, I see:
> 
> (gdb) stepi
> 0x000000040016ebcb      1845        __gmp_result =  mpn_popcount 
> (__gmp_u->_mp_d, __gmp_usize);
> (gdb)
> 0x000000046ace5dc0 in ?? ()
> (gdb)
> 
> Thread 1 received signal SIGSEGV, Segmentation fault.
> 0x000000046ace5dc0 in ?? ()

I don't see this here, with mingw.org's GMP library.

If you step through the code after typing

  (gdb) set debugexceptions on

what Windows exception is reported that leads to this SIGSEGV?

Also, could you try compiling and running the small program attached
below.  It is a slightly modified code of Flogcount, and I'm curious
to know whether it crashes in the same way if you compile it like the
crashing Emacs: with the -Og switch and with gmp.h set up for static
linking.  (It didn't crash for me here.)  Also, do you see there the
same call to __imp___gmpn_popcount as in the Emacs case.

After compiling this, you can run it with different arguments to get
the bit counts, and the result can be displayed as "echo %ERRORLEVEL%"
in cmd.exe or "echo $?"  in Bash.

#include <stdlib.h>
#include <gmp.h>

int
main (int argc, char *argv[])
{
  int value = argc > 1 ? atoi (argv[1]) : 42;
  mpz_t tem, tem1;
  int retval;
  mpz_init (tem);
  mpz_add_ui (tem, tem, value);
  if (mpz_sgn (tem) >= 0)
    retval = mpz_popcount (tem);
  else
    {
      mpz_init (tem1);
      mpz_neg (tem1, tem);
      mpz_sub_ui (tem1, tem1, 1);
      retval = mpz_popcount (tem1);
      mpz_clear (tem1);
    }
  return retval;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]