[PATCH] vfprintf: Add test case for user-defined types and format specifiers

Florian Weimer fweimer@redhat.com
Tue Jul 4 12:58:00 GMT 2017


On 06/29/2017 04:37 PM, Joseph Myers wrote:
> On Thu, 29 Jun 2017, Florian Weimer wrote:
> 
>> On 06/29/2017 02:39 PM, Andreas Schwab wrote:
>>> On Jun 29 2017, Florian Weimer <fweimer@redhat.com> wrote:
>>>
>>>> The need for the wint_t cast looks like a GCC bug.
>>>
>>> %lc wants wint_t.
>>
>> Sure, but why warn about this?  I doubt there are any architectures
>> which define wchar_t and wint_t in such a way that the variable
>> arguments promotion diverges.
> 
> The different signedness can break the ABI, if you pass a negative wchar_t 
> (so sign-extended to 64-bit) but the called function expects wint_t 
> (zero-extended to 64-bit).  (E.g., the powerpc64 ABI requires such 
> zero-extension of an unsigned argument.)

I see.  Based on what is said in the standard, the cast is indeed
required.  That's rather unfortunate from a programmer convenience point
of view.

Florian



More information about the Libc-alpha mailing list