builtin_atomic.c 739 B

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