https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91918
Bug ID: 91918 Summary: Const pointer argument to atomic_compare_exchange doesn't cause an error. Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mq at ucw dot cz Target Milestone: --- Passing second argument (desired) to atomic_compare_exchange as const pointer doesn'ลง cause an error and silently segfaults, as in this code. #include <stdatomic.h> static const int desired = 42; static _Atomic int data = 0; int main(void) { atomic_compare_exchange_weak(&data, &desired, 64); }