Dear guys I'm working on a C program with atomic reads and writes with multilple threads. However the compiler doesn't reorder instructions even with relaxed memory order. In what kinda cases does the compiler reorder instructions and how should I compile my instructions so that these optimisations take place
atomic_store_explicit(&x, 1, memory_order_relaxed);
atomic_store_explicit(&x, 2, memory_order_relaxed);
// atomic_thread_fence(memory_order_seq_cst);
printf("Thread A reads: %d\n", atomic_load_explicit(&y, memory_order_relaxed));