This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Atomic operations and unaligned memory
- From: Jason Merrill <jason at redhat dot com>
- To: Andrew Macleod <amacleod at redhat dot com>
- Cc: Jonathan Wakely <redi at gcc dot gnu dot org>, GCC <gcc at gcc dot gnu dot org>
- Date: Thu, 26 Mar 2015 16:02:16 -0400
- Subject: Atomic operations and unaligned memory
- Authentication-results: sourceware.org; auth=none
The wiki page https://gcc.gnu.org/wiki/Atomic/GCCMM/UnalignedPolicy says,
---
typedef char B3[3];
_Atomic B3 obj2;
An object will be promoted up to the next lock-free size in order to
enable lock free operations, as long as it isn't already a documented
lock free size. So obj2 will be promoted to a 4 byte object with
whatever alignment is required in order to enable lock-free operations.
---
But the implementation doesn't follow this. First, the above is
rejected due to applying _Atomic to an array type. If we wrap the array
in a struct, the resulting atomic object still has size 3 and alignment 1.
Did the design change, or is this a bug?
Jason