xroche wrote:

> Otherwise an object with dirty padding can make the loop fail forever

Indeed, oh my. Reworking this a little bit, the current design is flawed

```c++
#include <stdatomic.h>
union U {
  _Atomic(_BitInt(37)) a;
  unsigned long b;
};

int main(void) {
  union U u;
  u.b = ((unsigned long)1 << 40) | 5u;   // dirty padding bit + value 5
  (void)__c11_atomic_fetch_add(&u.a, (_BitInt(37))1, memory_order_seq_cst);
  return 0;
}
```


https://github.com/llvm/llvm-project/pull/204815
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to