builtin_15_atomic_pointer.c (248B)
1 int test_main(void) { 2 int arr[3]; 3 arr[0] = 10; 4 arr[1] = 20; 5 arr[2] = 12; 6 7 int* p = &arr[0]; 8 /* Atomically load p, then read through the loaded pointer. */ 9 int* q = __atomic_load_n(&p, __ATOMIC_ACQUIRE); 10 return q[0] + q[1] + q[2]; 11 }