1 static void fn(void)
   2 {
   3         static int i, *ptr = (void *)0;
   4 
   5         i = __sync_fetch_and_add(ptr, 0);
   6         i = __sync_fetch_and_sub(ptr, 0);
   7         i = __sync_fetch_and_or(ptr, 0);
   8         i = __sync_fetch_and_and(ptr, 0);
   9         i = __sync_fetch_and_xor(ptr, 0);
  10         i = __sync_fetch_and_nand(ptr, 0);
  11         i = __sync_add_and_fetch(ptr, 0);
  12         i = __sync_sub_and_fetch(ptr, 0);
  13         i = __sync_or_and_fetch(ptr, 0);
  14         i = __sync_and_and_fetch(ptr, 0);
  15         i = __sync_xor_and_fetch(ptr, 0);
  16         i = __sync_nand_and_fetch(ptr, 0);
  17         i = __sync_bool_compare_and_swap(ptr, 0, 1);
  18         i = __sync_val_compare_and_swap(ptr, 0, 1);
  19         __sync_synchronize();
  20         i = __sync_lock_test_and_set(ptr, 0);
  21         __sync_lock_release(ptr);
  22 }
  23 
  24 /*
  25  * check-name: __builtin_atomic
  26  * check-error-start
  27  * check-error-end
  28  */