aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/builtin_atomic.c
blob: e56321a867b09e567d99815623d541cf3dbde125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
static void fn(void)
{
	static int i, *ptr = (void *)0;

	i = __sync_fetch_and_add(ptr, 0);
	i = __sync_fetch_and_sub(ptr, 0);
	i = __sync_fetch_and_or(ptr, 0);
	i = __sync_fetch_and_and(ptr, 0);
	i = __sync_fetch_and_xor(ptr, 0);
	i = __sync_fetch_and_nand(ptr, 0);
	i = __sync_add_and_fetch(ptr, 0);
	i = __sync_sub_and_fetch(ptr, 0);
	i = __sync_or_and_fetch(ptr, 0);
	i = __sync_and_and_fetch(ptr, 0);
	i = __sync_xor_and_fetch(ptr, 0);
	i = __sync_nand_and_fetch(ptr, 0);
	i = __sync_bool_compare_and_swap(ptr, 0, 1);
	i = __sync_val_compare_and_swap(ptr, 0, 1);
	__sync_synchronize();
	i = __sync_lock_test_and_set(ptr, 0);
	__sync_lock_release(ptr);
}

/*
 * check-name: __builtin_atomic
 * check-error-start
 * check-error-end
 */