Test Failures on m1 MacBook Ventura: stack-overflow on address

Torbjörn Granlund tg at gmplib.org
Wed Nov 9 21:22:08 CET 2022


Pasta Pasta <pasta at dash.org> writes:

  Process 46677 launched:
  '/Users/user/Development/dash/src/test/test_dash' (arm64)
  Running 1 test case...
  Process 46677 stopped
  * thread #1, name = 'd-test', queue = 'com.apple.main-thread', stop
  reason = EXC_BAD_ACCESS (code=1, address=0x16fe00000)
      frame #0: 0x0000000100cd9e00 test_dash`__gmpn_sub_n + 120
  test_dash`:
  ->  0x100cd9e00 <+120>: ldp    x4, x5, [x1, #0x10]
      0x100cd9e04 <+124>: ldp    x8, x9, [x2, #0x10]
      0x100cd9e08 <+128>: sbcs   x12, x6, x10
      0x100cd9e0c <+132>: sbcs   x13, x7, x11
  Target 0: (test_dash) stopped.
  (lldb) bt
  * thread #1, name = 'd-test', queue = 'com.apple.main-thread', stop
  reason = EXC_BAD_ACCESS (code=1, address=0x16fe00000)
    * frame #0: 0x0000000100cd9e00 test_dash`__gmpn_sub_n + 120
      frame #1: 0x0000000100cd84e4 test_dash`fp_subc_low + 24
      frame #2: 0x0000000100cd9970 test_dash`fp3_sqrn_low + 220
  ```

  This pointed us to GMP as being the issue. We established the
  following procedure for testing GMP:

Well, somebody calls the GMP low-level function mpn_sub_n, and that
function crashes.  I would say that this is not unlikely that the
calling function is buggy.

But there was a problem with GMP 6.2.1 wrt MacOS, which is that register
18 is reserved, but GMP's assembler uses it.  We fixed that in the GMP
repo long ago,  You might want to try a GMP snapshot.

  ```
  wget https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2
  tar xf gmp-6.2.1.tar.bz2
  cd gmp-6.2.1
  ./configure
  make
  make check

Works on my M1 running Ventura.  I might have a better compiler (Apple
clang version 13.0.0).  There has been major problems with compiler bugs
on Apple M1.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list