Issue on windows build (mingw64)

Vlad Gabriel clampi at
Mon Apr 16 19:37:54 CEST 2012

Hello GMP developers,

I would like to report some issues compiling latest code from default mercurial branch:
$ hg tip
changeset:   14835:1e4085291ae4
tag:         tip
user:        Marco Bodrato <bodrato at>
date:        Mon Apr 16 07:35:54 2012 +0200
summary:     mpz/bin_uiui.c (mpz_bdiv_bin_uiui): Use precomputed factorials to init.

The system information is the same as in this post (

Now, for the issues.

Issue 1
Is related to latest changes in "mpz/bin_uiui.c" . The actual issue is an assertion failure in tests/mpz/t-bin

make[4]: Entering directory `/d/Prjs/mingw_src/gmp-build-64/tests/mpz'
[...other tests that pass...]

PASS: t-jac.exe
sbpi1_bdiv_q.c:81: GNU MP assertion failed: np[0] == 0

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
FAIL: t-bin.exe

Reason I am saying is related to latest changes in "mpz/bin_uiui.c" is that if I replace it with a pre-"2012-04-13 Marco Bodrato <bodrato at>" version, the test passes without assertion.

Stack trace at the assertion point
#0  __gmp_assert_fail (filename=0x6ada6627 "sbpi1_bdiv_q.c", linenum=81, expr=0x6ada6650 "np[0] == 0") at ../gmp-hg/assert.c:45
#1  0x000000006ad626e8 in __gmpn_sbpi1_bdiv_q (qp=0x22fac8, np=0x22fac0, nn=3, dp=0x22fa00, dn=3, dinv=1833607634379141975) at sbpi1_bdiv_q.c:81
#2  0x000000006acd2ea1 in mpz_bdiv_bin_uiui (r=0x22fd80, n=142, k=71) at ../../gmp-hg/mpz/bin_uiui.c:277
#3  0x000000006acd3a92 in __gmpz_bin_uiui (r=0x22fd80, n=142, k=71) at ../../gmp-hg/mpz/bin_uiui.c:456
#4  0x00000000004018bf in try_mpz_bin_uiui (want=0x22fdc0, n=142, k=71) at ../../../gmp-hg/tests/mpz/t-bin.c:56
#5  0x0000000000401c37 in twos (count=200) at ../../../gmp-hg/tests/mpz/t-bin.c:155
#6  0x0000000000402064 in main (argc=1, argv=0x3421d0) at ../../../gmp-hg/tests/mpz/t-bin.c:263

Issue 2
Is related with latest changes in mpn/x86_64/coreisbr/lshift.asm, mpn/x86_64/coreisbr/lshiftc.asm, etc
The build issue is that lots of tests/mpn/* fail with SIGSEV

Root cause is that the new mpn/x86_64/coreisbr/*.asm files are declared as supporting WIN64 ABI (ABI_SUPPORT(DOS64)), but the actual implementation in mpn/x86_64/fastsse/*.asm does not really support that. Following patch, while not necessary up to GMP coding standards and asm speed standards solves the issue (issue 1 still remains).
Attached gmp-0004-mingw64-asm.patch

Best Regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-0004-mingw64-asm.patch
Type: text/x-diff
Size: 2922 bytes
Desc: not available
URL: <>

More information about the gmp-bugs mailing list