Summary: | size of atomic object is not correct | ||
---|---|---|---|
Product: | gcc | Reporter: | Alexey Lapshin <alexey.lapshin> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 4.9.2 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Alexey Lapshin
2015-02-20 19:09:04 UTC
On Fri, 20 Feb 2015, alexey.lapshin at oracle dot com wrote:
> The size of atomic object does not match with documentation -
> https://gcc.gnu.org/wiki/Atomic/GCCMM/UnalignedPolicy specifically :
That's not documentation. It's an early description of intent that does
not correspond to what was actually implemented (note the future tense in
the words you quote, and the last edited date a year before I added
_Atomic support to trunk based on Andrew's work). In general, old wiki
pages are left around as they may help understand archived development
discussions.
Hi Joseph, Could you help me with a link to the correct description of atomic ABI, which in fact used by gcc/g++, please ? Thank you, Alexey. 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.)
Not a bug; there is no intent to increase object size with _Atomic. |