x86_64-w64-mingw32 test FAIL t-scanf.c:1477: GNU MP assertion failed: ret == (-1)

Claude Heiland-Allen claude at mathr.co.uk
Fri Mar 31 11:12:28 UTC 2017


Hi Marc,

On 31/03/17 00:27, Marc Glisse wrote:
> On Thu, 30 Mar 2017, Vincent Lefevre wrote:
> 
>> On 2017-03-30 10:52:33 +0100, Claude Heiland-Allen wrote:
>>> The failing source code is:
>>>
>>>   /* EOF for no matching */
>>>   {
>>>     char buf[128];
>>>     ret = gmp_sscanf ("   ", "%s", buf);
>>>     ASSERT_ALWAYS (ret == EOF);
>>>     ret = fromstring_gmp_fscanf ("   ", "%s", buf);
>>>     ASSERT_ALWAYS (ret == EOF);
>>>     if (option_libc_scanf)
>>>       {
>>>         ret = sscanf ("   ", "%s", buf);
>>>         ASSERT_ALWAYS (ret == EOF);
>>>         ret = fun_fscanf ("   ", "%s", buf, NULL);
>>>         ASSERT_ALWAYS (ret == EOF);
>>>       }
>>>   }
>>>
>>> Commenting out the asserts and 'if' and inserting debugging printf()
>>> statements gives:
>>>
>>>     gmp_sscanf() ret = 0
>>>     fromstring_gmp_fscanf() ret = 0
>>>     sscanf() ret = 0
>>      ^^^^^^^^^^^^^^^^
>>>     fun_fscanf() ret = 0
>>
>> The initial issue is the 0 returned by sscanf(). Then GMP is consistent
>> with the C implementation.
>>
>> Though the C standard may be ambiguous, 0 is not possible as a return
>> value. Thus this is a bug in the C library (or compiler).
> 
> Could the macro __USE_MINGW_ANSI_STDIO be relevant?

Yes, perfect!  I did

    CPPFLAGS=-D__USE_MINGW_ANSI_STDIO ./configure
--host=x86_64-w64-mingw32 --prefix=$HOME/win64
    CPPFLAGS=-D__USE_MINGW_ANSI_STDIO make -j 8
    CPPFLAGS=-D__USE_MINGW_ANSI_STDIO make install
    CPPFLAGS=-D__USE_MINGW_ANSI_STDIO make check

and the whole test suite passes now.

Thanks,


Claude
-- 
https://mathr.co.uk


More information about the gmp-bugs mailing list