printf/repl-vsnprintf.c bug (was: GMP|MPIR|MPFR assertions)

sav_ix at ukr.net sav_ix at ukr.net
Thu Jan 18 16:45:53 UTC 2018





--- Оригінальне повідомлення ---
Від кого: "Vincent Lefevre" <vincent at vinc17.net>
Дата: 18 січня 2018, 16:07:10


> Proposed patch attached. Not tested.


--- Оригінальне повідомлення ---
Від кого: "paul zimmermann" <paul.zimmermann at inria.fr>
Дата: 18 січня 2018, 16:16:44


> here is a test case to reproduce the issue (you have to test it on a system that
> doesn't have vsnprintf, or only has a broken one, or define HAVE_VSNPRINTF to 0 in
> config.h):

and '--enable-assert' flag should be used for GMP build.



Using Paul's testcase and Vincent's patch got results:

1. For builds using mingw-w64 without '__USE_MINGW_ANSI_STDIO' flag (which targets 'msvcrt.dll' with broken 'vsnprintf()', seehttps://github.com/msys2/msys2/wiki/Porting#c-printf-format-specifier-issues):

  a) testcase output:
    - for vanilla GMP sources:
===============================================================
c:\test>gcc gmp_vsnprintf_test.c -I. -L. -lgmp && a.exe
repl-vsnprintf.c:357: GNU MP assertion failed: 0

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
=============================================================== 

    - for patched GMP sources:
===============================================================
c:\test>gcc gmp_vsnprintf_test.c -I. -L. -lgmp && a.exe
size=12 s='17.000000 42'
=============================================================== 

  b) MPFR testsuite summary:
    - for vanilla GMP sources:
for vanilla GMP sources:===============================================================
...
FAIL: tfprintf.exe
...
FAIL: tprintf.exe
...
FAIL: tsprintf.exe
...
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 180
# PASS:  177
# SKIP:  0
# XFAIL: 0
# FAIL:  3
# XPASS: 0
# ERROR: 0
============================================================================
=============================================================== 

    - for patched GMP sources:
===============================================================
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 180
# PASS:  180
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
=============================================================== 


2. For builds using MSVC (which targets 'ucrtbase.dll' with broken 'vsnprintf()', see https://developercommunity.visualstudio.com/content/problem/168219/incomplete-ansi-c99-stdio-support-in-windows-sdk.html):

  a) testcase output:
    - for vanilla GMP sources:
===============================================================
c:\test>cl gmp_vsnprintf_test.c -I. -MDd gmp.lib && gmp_vsnprintf_test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

gmp_vsnprintf_test.c
Microsoft (R) Incremental Linker Version 14.12.25830.2
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:gmp_vsnprintf_test.exe
gmp_vsnprintf_test.obj
gmp.lib
repl-vsnprintf.c:357: GNU MP assertion failed: 0
=============================================================== 

    - for patched GMP sources:
===============================================================
c:\test>cl gmp_vsnprintf_test.c -I. -MDd gmp.lib && gmp_vsnprintf_test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

gmp_vsnprintf_test.c
Microsoft (R) Incremental Linker Version 14.12.25830.2
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:gmp_vsnprintf_test.exe
gmp_vsnprintf_test.obj
gmp.lib
size=12 s='17.000000 42'
=============================================================== 

    b) MPFR testsuite summary:
    - for vanilla GMP sources:
for vanilla GMP sources:===============================================================
...
FAIL: tfprintf.exe
...
FAIL: tprintf.exe
...
FAIL: tsprintf.exe
...
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 180
# PASS:  174
# SKIP:  3
# XFAIL: 0
# FAIL:  3
# XPASS: 0
# ERROR: 0
============================================================================
=============================================================== 

    - for patched GMP sources:
===============================================================
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 180
# PASS:  177
# SKIP:  3
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
=============================================================== 


Environment:
  - Windows 10 x64,
  - mingw-w64 7.2.0 x86_64-posix-seh,
  - ICC 2018 Update 1,
  - MSVC 2017 15.5.0,
  - Windows SDK 10.0.16299.15,
  - MSYS2 x86_64 20170918,
  - GMP-6.1.99-dev-r17531,
  - MPFR-4.1.0-dev-r12096.


Thank you for help, Paul, Rob, Vincent. Going to use this patch until the fix would appear in GMP master. 


Best,

Alexander



More information about the gmp-bugs mailing list