On 01.02.2015 1:02, Erik van Pienbroek wrote:
> Erik van Pienbroek schreef op za 31-01-2015 om 21:21 [+0100]:
>> JonY schreef op za 31-01-2015 om 20:35 [+0800]:
>>> On 1/30/2015 08:10, Erik van Pienbroek wrote:
>>>>
>>>> All in all I see no blocking issues in mingw-w64 v4.0rc1.
>>>
>>> OK, will go ahead with v4.0.0 shortly if there are no objections.
>>
>> Is there still interest in doing another test mass rebuild against the
>> latest gcc 5 snapshot before releasing mingw-w64 v4.0?
> 
> Apparently gcc 5 is busted at the moment (20150125 snapshot, svn
> r220097) as it fails to build with this error:
> 
> ../../../libgomp/target.c: In function 'gomp_map_vars':
> ../../../libgomp/target.c:440:21: error: unknown conversion type
> character 'z' in format [-Werror=format=]
>          gomp_fatal ("present clause: !acc_is_present (%p, "
>                      ^
> ../../../libgomp/target.c:440:21: error: unknown conversion type
> character 'z' in format [-Werror=format=]
> ../../../libgomp/target.c:440:21: error: too many arguments for format
> [-Werror=format-extra-args]
> 
> 
> The offending line contains this piece of code:
>     gomp_fatal ("present clause: !acc_is_present (%p, "
>                 "%zd (0x%zx))", (void *) k->host_start,
>                 size, size);
> 
> I have no idea whether this is a gcc issue or a mingw-w64 one...

Could be a libgomp issue.
GCC treats all functions attributed with "format printf" differently, depending 
on whether the target is W32 or not W32. For W32 it defaults to ms_printf, for 
non-W32 - gnu_printf. ms_printf doesn't support %z, gnu_printf does. This only 
affects format checking and is not directly related to the implementation of 
the printf function in question.

This is what libgomp.h in 5.0 master says:

extern void gomp_fatal (const char *, ...)
        __attribute__ ((noreturn, format (printf, 1, 2)));

This defaults to ms_printf.

The actual function called in the end is vfprintf, which could be from msvcrt 
(ms_printf-compatible) or libmingwex (gnu_printf-compatible) depending on 
whether __USE_MINGW_ANSI_STDIO is defined to 1 or not.

(An aside: headers use the "#if __USE_MINGW_ANSI_STDIO" form, which may cause 
warnings in some gcc warning modes if __USE_MINGW_ANSI_STDIO is undefined. 
Consider fixing this).

Possible fixes:
A) Make "%z" the primary, fix libgomp (gcc) to explicitly decorate gomp_fatal 
and gomp_fatal_va as gnu_printf. When compiled without a gnu-compatible 
vfprintf, it will behave incorrectly at runtime, when a gmp error happens.
B) Make printf the primary, fix libgomp (gcc) to use different format strings 
depending on the host. According to [1], the right format for size_t for MS CRT 
is "Iu". This could be a configure-time check, compile a bunch of test programs 
with different format strings for size_t with -Werror, see which one works.
C) Force libgomp to be compiled with __USE_MINGW_ANSI_STDIO defined to 1. This 
might not sit well with non-mingw SDKs that compile gcc (sounds weird...).

[1] 
https://stackoverflow.com/questions/15610053/correct-printf-format-specifier-for-size-t-zu-or-iu

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

Attachment: 0x922360B0.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to