https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81821
Bug ID: 81821 Summary: [RX] __atomic_test_and_set overwrites adjacent memory Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- __atomic_test_and_set is supposed to change only one byte, but on RX it wrongly overwrites adjacent memory locations: int test (volatile char* x) { return __atomic_test_and_set (x, 0); } __Z4testPVc: mov #1, r14 xchg [r1], r14 // xchg is 32 bit movu.B r14, r1 rts It seems a .b or .w specifier can be added to the memory operand of xchg.