This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Atomic alignment override.


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


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