Possible issue on windows build (mingw)

Vlad Gabriel clampi at yahoo.com
Mon Apr 2 10:30:43 CEST 2012


Hello all,

While building the latest gmp (from Mercurial repository) I ran the following commands:

cd gmp-hg

./.bootstrap

cd ..
mkdir gmp-build-64
cd gmp-build-64
export CFLAGS="-ggdb3  -fvar-tracking-assignments"
export CXXFLAGS="-ggdb3  -fvar-tracking-assignments"
export LDFLAGS="-ggdb3  -fvar-tracking-assignments"

../gmp-hg/configure --enable-maintainer-mode --enable-cxx --enable-shared --disable-static --enable-assert
[...configure runs, correctly detects my processor as I7 Sandy Bridge, which is correct ...]
make
make -k check


Durig the check, I see some errors reported:
[...]
make[4]: Entering directory `/d/Prjs/mingw_src/gmp-build-64/tests/mpn'
PASS: t-asmtype.exe
PASS: t-aors_1.exe
PASS: t-divrem_1.exe
PASS: t-mod_1.exe
PASS: t-fat.exe
PASS: t-get_d.exe
PASS: t-instrument.exe
PASS: t-iord_u.exe
PASS: t-mp_bases.exe
PASS: t-perfsqr.exe
PASS: t-scan.exe
PASS: logic.exe
PASS: t-toom22.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom32.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom33.exe
toom_interpolate_12pts.c:256: GNU MP assertion failed: (DO_mpn_sublsh_n ((pp + 7 * n), r3, n3p1, 5, wsi)) == 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-toom42.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom43.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom44.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom52.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom53.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom54.exe
PASS: t-toom62.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom63.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom6h.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-toom8h.exe
PASS: t-mul.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-mullo.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-mulmod_bnm1.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-sqrmod_bnm1.exe
PASS: t-mulmid.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-hgcd.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-hgcd_appr.exe
PASS: t-matrix22.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-invert.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-div.exe
toom_eval_pm2exp.c:112: GNU MP assertion failed: (k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)

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-bdiv.exe
======================================================================================
19 of 36 tests failed
Please report to gmp-bugs at gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html
====================================================================================== 
[... more errors..., full check log attached]

I tarted to investigate the cause, and seems to be configure | assambler related. Reason I am saying this is because I ran the same commands but with this config options
../gmp-hg/configure --prefix=/mingw64 --enable-maintainer-mode --enable-cxx --enable-shared --disable-static --enable-assert --disable-assembly

Now, without the assembly in the way, I get only 1 assertion during the "make check"

make[4]: Entering directory `/d/Prjs/mingw_src/gmp-build-64/tests/mpz'
PASS: t-addsub.exe
PASS: t-cmp.exe
PASS: t-mul.exe
PASS: t-mul_i.exe
PASS: t-tdiv.exe
PASS: t-tdiv_ui.exe
PASS: t-fdiv.exe
PASS: t-fdiv_ui.exe
PASS: t-cdiv_ui.exe
PASS: t-gcd.exe
PASS: t-gcd_ui.exe
PASS: t-lcm.exe
PASS: t-invert.exe
PASS: dive.exe
PASS: dive_ui.exe
PASS: t-sqrtrem.exe
PASS: convert.exe
PASS: io.exe
PASS: t-inp_str.exe
PASS: logic.exe
PASS: bit.exe
PASS: t-powm.exe
PASS: t-powm_ui.exe
PASS: t-pow.exe
PASS: t-div_2exp.exe
Test suppressed for windows DLL
PASS: reuse.exe
PASS: t-root.exe
PASS: t-perfsqr.exe
PASS: t-perfpow.exe
PASS: t-jac.exe
PASS: t-bin.exe
PASS: t-get_d.exe
PASS: t-get_d_2exp.exe
PASS: t-get_si.exe
PASS: t-set_d.exe
PASS: t-set_si.exe
../../gmp-hg/mpz/oddfac_1.c:601: GNU MP assertion failed: ((((mswing)->_mp_size)) >= 0 ? (((mswing)->_mp_size)) : -(((mswing)->_mp_size))) < ((mswing)->_mp_alloc) / 2

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-fac_ui.exe
PASS: t-fib_ui.exe
PASS: t-lucnum_ui.exe
PASS: t-scan.exe
PASS: t-fits.exe
PASS: t-divis.exe
PASS: t-divis_2exp.exe
PASS: t-cong.exe
PASS: t-cong_2exp.exe
PASS: t-sizeinbase.exe
PASS: t-set_str.exe
PASS: t-aorsmul.exe
PASS: t-cmp_d.exe
PASS: t-cmp_si.exe
PASS: t-hamdist.exe
PASS: t-oddeven.exe
PASS: t-popcount.exe
PASS: t-set_f.exe
PASS: t-io_raw.exe
PASS: t-import.exe
PASS: t-export.exe
PASS: t-pprime_p.exe
PASS: t-nextprime.exe
======================================================================================
1 of 59 tests failed
Please report to gmp-bugs at gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html
======================================================================================

Building with a different compiler (32 bit only), with ABI=32, same commands given to configure, showed the same assertion error.

Now, here is the full information about my system.

Windows 7 SP1 x86-64
$ uname -a
MINGW32_NT-6.1 CLAMPINEW 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys

$ config.guess
coreisbr-pc-mingw32
$ configfsf.guess
i686-pc-mingw32
config.log attached.
Stack trace of some of the assertions
t-fac_ui.exe (64bit)
#0  __gmp_assert_fail (filename=0x6ad60886 "../../gmp-hg/mpz/oddfac_1.c", linenum=601, expr=0x6ad60bc0 "((((mswing)->_mp_size)) >= 0 ? (((mswing)->_mp_size)) : -(((mswing)->_mp_size))) < ((mswing)->_mp_alloc) / 2") at ../gmp-hg/assert.c:45
#1  0x000000006acd4d4e in __gmpz_oddfac_1 (x=0x22fde0, n=733, flag=4294967295) at ../../gmp-hg/mpz/oddfac_1.c:601
#2  0x000000006acd3830 in __gmpz_fac_ui (x=0x22fde0, n=733) at ../../gmp-hg/mpz/fac_ui.c:95
#3  0x0000000000401757 in main (argc=1, argv=0x3f21f0) at ../../../gmp-hg/tests/mpz/t-fac_ui.c:59
t-fac_ui.exe (32bit)
#0  __gmp_assert_fail (filename=0x6ad56726 "../../gmp-hg/mpz/oddfac_1.c", linenum=601, expr=0x6ad56a5c "((((mswing)->_mp_size)) >= 0 ? (((mswing)->_mp_size)) : -(((mswing)->_mp_size))) < ((mswing)->_mp_alloc) / 2") at ../gmp-hg/assert.c:45
#1  0x6acd3dcf in __gmpz_oddfac_1 (x=0x28fee4, n=301, flag=4294967295) at ../../gmp-hg/mpz/oddfac_1.c:601
#2  0x6acd2d04 in __gmpz_fac_ui (x=0x28fee4, n=301) at ../../gmp-hg/mpz/fac_ui.c:95
#3  0x0040145e in main (argc=1, argv=0x622588) at ../../../gmp-hg/tests/mpz/t-fac_ui.c:59
t-toom33.exe (64bit)
#0  __gmp_assert_fail (filename=0x6ad71fb7 "toom_eval_pm2exp.c", linenum=112, expr=0x6ad72070 "(k+1)*shift >= 64 || xp2[n] < ((((mp_limb_t) 1LL)<<((k+1)*shift))-1)/((((mp_limb_t) 1LL)<<shift)-1)") at ../gmp-hg/assert.c:45
#1  0x000000006ad2df77 in __gmpn_toom_eval_pm2exp (xp2=0x227318, xm2=0x226fe8, k=6, xp=0x22f160, n=50, hn=15, shift=2, tp=0x2264f8) at toom_eval_pm2exp.c:111
#2  0x000000006ad23972 in __gmpn_toom6h_mul (pp=0x2264f8, ap=0x22f160, an=315, bp=0x22d150, bn=296, scratch=0x21b560) at toom6h_mul.c:178
#3  0x000000006acf6601 in __gmpn_mul (prodp=0x2264f8, up=0x22f160, un=315, vp=0x22d150, vn=296) at mul.c:362
#4  0x000000006ad1e453 in __gmpn_toom33_mul (pp=0x223d58, ap=0x22dd90, an=949, bp=0x22bd80, bn=930, scratch=0x21db38) at toom33_mul.c:260
#5  0x0000000000401a09 in main (argc=1, argv=0x3a21f0) at ../../../gmp-hg/tests/mpn/toom-shared.h:118
t-toom42.exe (64bit)
#0  __gmp_assert_fail (filename=0x6ad73022 "toom_interpolate_12pts.c", linenum=256, expr=0x6ad73438 "(DO_mpn_sublsh_n ((pp + 7 * n), r3, n3p1, 5, wsi)) == 0") at ../gmp-hg/assert.c:45
#1  0x000000006ad31f25 in __gmpn_toom_interpolate_12pts (pp=0x221d38, r1=0x21d730, r3=0x21cf70, r5=0x21d350, n=41, spt=72, half=0, wsi=0x21cb90) at toom_interpolate_12pts.c:256
#2  0x000000006ad24d9f in __gmpn_toom6h_mul (pp=0x221d38, ap=0x220d30, an=241, bp=0x21f650, bn=241, scratch=0x21cb90) at toom6h_mul.c:216
#3  0x000000006acfa5b0 in __gmpn_mul_n (p=0x221d38, a=0x220d30, b=0x21f650, n=241) at mul_n.c:68
#4  0x000000006ad1b847 in __gmpn_toom42_mul (pp=0x225d68, ap=0x22dd90, an=874, bp=0x22c830, bn=481, scratch=0x221d38) at toom42_mul.c:180
#5  0x0000000000401ab8 in main (argc=1, argv=0x6b21f0) at ../../../gmp-hg/tests/mpn/toom-shared.h:118
t-powm.exe (64bit)
#0  __gmp_assert_fail (filename=0x6ad71fb7 "toom_eval_pm2exp.c", linenum=63, expr=0x6ad72000 "(__gmpn_add_1 (tp + hn, tp + hn, n+1 - hn, cy)) == 0") at ../gmp-hg/assert.c:45
#1  0x000000006ad2dd92 in __gmpn_toom_eval_pm2exp (xp2=0x5c9b30, xm2=0x5c9870, k=5, xp=0x5c7678, n=43, hn=41, shift=2, tp=0x5c8f08) at toom_eval_pm2exp.c:63
#2  0x000000006ad23972 in __gmpn_toom6h_mul (pp=0x5c8f08, ap=0x5c7678, an=256, bp=0x5c7ec8, bn=256, scratch=0x21d710) at toom6h_mul.c:178
#3  0x000000006acfa5b0 in __gmpn_mul_n (p=0x5c8f08, a=0x5c7678, b=0x5c7ec8, n=256) at mul_n.c:68
#4  0x000000006acf4b3d in __gmpn_mul (prodp=0x5c8f08, up=0x5c7678, un=256, vp=0x5c7ec8, vn=256) at mul.c:122
#5  0x000000006acddd1b in __gmpz_mul (w=0x22fda0, u=0x22fda0, v=0x22fd70) at ../../gmp-hg/mpz/mul.c:139
#6  0x0000000000401c40 in main (argc=1, argv=0x5c21e0) at ../../../gmp-hg/tests/mpz/t-powm.c:120

To sum up, the "bugs":
-    Either configure picks up the wrong assembler routines, or the routines are not designed to work with windows calling convention.
-    The assertion I get in t-fac_ui with both 32bit and 64bit compilations.

Best regards,
Gabriel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp_test.zip
Type: application/zip
Size: 4607 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20120402/773ef1cc/attachment-0002.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-64-config.zip
Type: application/zip
Size: 84165 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20120402/773ef1cc/attachment-0003.zip>


More information about the gmp-bugs mailing list