This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]