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: Joseph Myers <joseph at codesourcery dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Tue, 30 Dec 2014 20:46:01 +0000
- 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>
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.
--
Joseph S. Myers
joseph@codesourcery.com