2 /* { dg-options "-std=c++0x" } */
3 /* { dg-final { simulate-thread } } */
10 #include "simulate-thread.h"
14 /* Non-atomic. Use a type wide enough to possibly coerce GCC into
15 moving things around. */
19 /* Test that an atomic store synchronizes with an atomic load.
21 In this case, test that the store to <j> happens-before the atomic
22 store to <atomi>. Make sure the compiler does not reorder the
24 __attribute__((noinline))
25 void simulate_thread_main()
33 simulate_thread_main();
34 simulate_thread_done();
38 void simulate_thread_other_threads()
42 /* Verify that side-effects before an atomic store are correctly
43 synchronized with the an atomic load to the same location. */
44 int simulate_thread_step_verify()
46 if (atomi.load() == 1 && j != 13.0)
48 printf ("FAIL: invalid synchronization for atomic load/store.\n");
55 int simulate_thread_final_verify()
57 return simulate_thread_step_verify();