This is the mail archive of the gcc@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]

Atomic operations and unaligned memory


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


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