assertion failure in snprntffuns.c:79 for i686-w64-mingw32

Vincent Lefevre vincent at
Fri Jan 10 01:54:51 UTC 2020

Under Debian/unstable, I've configured GMP with:

  ./configure --host=i686-w64-mingw32 --disable-shared --enable-assert

but "make check LOG_COMPILER=wine" gives:

FAIL: t-printf

snprntffuns.c:79: GNU MP assertion failed: strlen (d->buf) == avail-1
FAIL t-printf.exe (exit status: 3)

The failing code is

      ret = vsnprintf (d->buf, avail, fmt, ap);
      if (ret == -1)
          ASSERT (strlen (d->buf) == avail-1);
          ret = avail-1;

I don't understand the ASSERT. A return value of -1 means an output
error, so that you cannnot deduce anything about the contents stored
in d->buf.

The first error occurs in check_limb

      s = mpz_get_str (NULL, 10, z);
      check_one (s, "%Mu", limb);
      (*__gmp_free_func) (s, strlen (s) + 1);

for i = 7, i.e. with limb = 127.

Note that config.h contains

/* Define to 1 if you have the `vsnprintf' function and it works properly. */

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-bugs mailing list