[Bug c/68966] New: atomic_fetch_* on atomic_bool not diagnosed
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 17 17:00:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list