This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Atomic alignment override.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Andrew MacLeod <amacleod at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Hans-Peter Nilsson <hp at bitrange dot com>
- Date: Fri, 22 Nov 2013 13:13:54 +0000
- Subject: Re: [patch] Atomic alignment override.
- Authentication-results: sourceware.org; auth=none
- References: <528E8D43 dot 2050101 at redhat dot com> <CAFiYyc2z9VSfvtN9_PhWCGagnvTr6J4xNbfv4AfiM56ae7ULNQ at mail dot gmail dot com> <20131122113416 dot GY892 at tucnak dot redhat dot com>
On Fri, 22 Nov 2013, Jakub Jelinek wrote:
> How do i?86 _Atomic long long and _Atomic long double work btw?
> At least when they are inside of structures, they have 4 byte alignment.
If the generic libatomic functions are called, they use locking if
alignment is inadequate (libatomic presumes natural alignment is the
required alignment for size-specific operations). If the operations are
inlined or the size-specific libatomic functions are called, you may
indeed have problems. Plausible fixes for such issues include:
* Probably x86_field_alignment should not reduce alignment for fields of
atomic type.
* The code in c-common.c resolving size-generic atomic builtins to
size-specific ones should not do so if the alignment is less than natural
(taking account of possible alignment reductions for fields, so working
out pointer target alignment conservatively).
(And of course add testcases for any bugs this fixes.)
--
Joseph S. Myers
joseph@codesourcery.com