This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: Fix powerpc64 build with GCC 5.0
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 31 Dec 2014 17:01:58 -0200
- Subject: Re: RFC: Fix powerpc64 build with GCC 5.0
- Authentication-results: sourceware.org; auth=none
- References: <54A306B6 dot 9000707 at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 10 dot 1412302032260 dot 17381 at digraph dot polyomino dot org dot uk>
On 30-12-2014 18:46, Joseph Myers wrote:
> On Tue, 30 Dec 2014, Adhemerval Zanella wrote:
>
>> And this comes from sysdep.h:
>>
>> if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \
>> __illegally_sized_syscall_arg3 (); \
>>
>> My understanding is since we already testing if argument is a 'pointer_type_class'
>> (__builtin_classify_type equal to 5), thus the sizeof test is superfluous. Would be
>> a correct fix to just remove these tests? Thoughts?
> I don't think either test is superfluous.
>
> The point of checking __builtin_classify_type is to avoid errors on string
> literal arguments, where sizeof inhibits array-to-pointer conversion (but
> __builtin_classify_type doesn't, so string literals count as pointers for
> __builtin_classify_type).
>
> If __builtin_classify_type (__arg3) != 5, that means the argument - after
> array-to-pointer conversion - is *not* a pointer. Pointers would never
> satisfy sizeof (__arg3) > 8, but non-pointers might (e.g. structures) and
> in that case would be invalid syscall arguments.
>
> Assuming we want this checking at all (and if anything, my inclination
> would be that it should go in some sort of generic __check_syscall_arg
> macros in generic sysdeps/unix files, not be architecture-specific), my
> inclination would be to insert an explicit cast to (const struct timespec
> *) in utimensat.c, with a comment to explain why it's there.
>
I see what I overlook then and I will prepare a patch using casts to cleanup
powerpc build. Thanks!