This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] vfprintf: Add test case for user-defined types and format specifiers
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 4 Jul 2017 14:58:11 +0200
- Subject: Re: [PATCH] vfprintf: Add test case for user-defined types and format specifiers
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2F8D5C04B939
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F8D5C04B939
- References: <20170619134830.6E09B402AEC20@oldenburg.str.redhat.com> <7b5f9ce5-abf8-5263-1d80-250fe7571982@redhat.com> <CAMe9rOqjhyZZVq_iKt02t+wLM6wE-Paau3hwiYexGOstLhzGFw@mail.gmail.com> <a63cc9fe-b07a-3426-c530-46a02230663e@redhat.com> <mvmmv8rklx1.fsf@suse.de> <04a2ff4f-98c8-acaa-3dd7-8a15ebda32c3@redhat.com> <alpine.DEB.2.20.1706291436190.7727@digraph.polyomino.org.uk>
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