This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH roland/cancelhandling] NPTL: Give cancelhandling fields type unsigned int.
- From: Torvald Riegel <triegel at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Tue, 30 Jun 2015 19:11:38 +0200
- Subject: Re: [PATCH roland/cancelhandling] NPTL: Give cancelhandling fields type unsigned int.
- Authentication-results: sourceware.org; auth=none
- References: <20150625000729 dot 9C7912C3B00 at topped-with-meat dot com>
On Wed, 2015-06-24 at 17:07 -0700, Roland McGrath wrote:
> This perturbed code generation for pthread_detach.c a bit more than I would
> have thought (on x86_64, i686, and arm), and I can't see any reason for
> that. But I think the semantics of the generated code are identical. The
> only other change to generated code is for nptl-init.c, where the compiler
> reversed the order of operands in a comparison instruction--but one where
> only eq/ne is ever tested, so it's trivially equivalent.
>
> I wouldn't mind another set of eyes on the code generation changes to
> verify they are indeed wholly harmless.
What about the loads from cancelhandling that assign to an int variable
in these files:
nptl/cleanup_defer_compat.c
nptl/allocatestack.c
nptl/pthread_setcanceltype.c
nptl/cancellation.c
nptl/cleanup_defer.c
...
Shouldn't those variables be changed to unsigned int too?
All (or almost all) of those accesses should use atomics. It may be
better to keep the casts in the futex_* calls for now and clean this up
in one chunk, using atomics and unsigned int everywhere.