Suppose that I have the following type:
struct T {
int32 high;
int32 low;
};
Is it defined behavior to perform atomic accesses (using, e.g. atomic_load, atomic_fetch_add) on all of x, &x->high, and &x->low (assuming U* x)?
My understanding is that the C/C++ memory models are defined using histories of over individual locations (to accommodate weak memory architectures). If accesses can cross locations, does this mean synchronization across locations? If that is the case, then I assume that would imply that histories are essentially per-byte and accessing an int is just like synchronizing across the underlying 4 (or 8) bytes.
edit: revised the example to avoid the union since the main part of the question is about the concurrency model.
edit: revised to use the standard atomics from stdatomic.h