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 2/6] Use INLINE_SYSCALL_ERROR_RETURN


On Tue, Oct 13, 2015 at 6:58 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/13/2015 03:56 PM, H.J. Lu wrote:
>
>> It looks (ptrdiff_t) isn't needed.
>
> It's not needed on x86_64, but we don't know if there will be
> architectures which will eventually need it (or already do).  The
> existing code had -1L, so I assumed it was better to play it safe and
> mirror that.

Yes, the cast is also needed on x86-64 if __syscall_error is used:

[hjl@gnu-tools-1 tmp]$ cat x.c
#include <stddef.h>

extern int __syscall_error (void);
void *p;

void
foo (void)
{
  p = (void *) (ptrdiff_t) __syscall_error ();
}
[hjl@gnu-tools-1 tmp]$


-- 
H.J.


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