https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68966
Bug ID: 68966 Summary: atomic_fetch_* on atomic_bool not diagnosed Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- As Martin pointed out here <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68908#c13>, C doesn't allow the atomic_fetch_xxx operations to be used with the atomic_bool type (it says they're "not applicable" without spelling what that means, but that will be the subject of a future defect). But we don't diagnose this. typedef _Atomic _Bool atomic_bool; void fn (void) { atomic_bool a = 1; __atomic_fetch_add (&a, 1, __ATOMIC_SEQ_CST); __atomic_fetch_sub (&a, 1, __ATOMIC_SEQ_CST); __atomic_fetch_and (&a, 1, __ATOMIC_SEQ_CST); __atomic_fetch_xor (&a, 1, __ATOMIC_SEQ_CST); __atomic_fetch_or (&a, 1, __ATOMIC_SEQ_CST); __atomic_fetch_nand (&a, 1, __ATOMIC_SEQ_CST); __atomic_add_fetch (&a, 1, __ATOMIC_SEQ_CST); __atomic_sub_fetch (&a, 1, __ATOMIC_SEQ_CST); __atomic_and_fetch (&a, 1, __ATOMIC_SEQ_CST); __atomic_xor_fetch (&a, 1, __ATOMIC_SEQ_CST); __atomic_or_fetch (&a, 1, __ATOMIC_SEQ_CST); __atomic_nand_fetch (&a, 1, __ATOMIC_SEQ_CST); } There's related bug 64843 for atomic_fetch_* on pointers.