This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65145] size of atomic object is not correct
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Feb 2015 23:19:16 +0000
- Subject: [Bug c/65145] size of atomic object is not correct
- Auto-submitted: auto-generated
- References: <bug-65145-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65145
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Fri, 20 Feb 2015, alexey.lapshin at oracle dot com wrote:
> Hi Joseph,
>
> Could you help me with a link to the correct description of atomic ABI,
> which in fact used by gcc/g++, please ?
I don't believe it's documented, but I think the general rule for C is: if
a type's size is 1, 2, 4, 8, 16, its alignment is increased by _Atomic to
that of the atomic integer type of that size, which is the same as that of
the non-atomic integer type unless increased by
TARGET_ATOMIC_ALIGN_FOR_MODE; the size is never increased by _Atomic, and
alignment of types not of those sizes is unchanged. If the code differs,
likely the code should take precedence over that description. (But of
course if a type is under-aligned for the instructions used to operate on
it, there's a bug, whether in the alignment or in the instruction choice.)