1 /* { dg-do link } */ 2 /* { dg-final { simulate-thread } } */ 3 4 #include <stdio.h> 5 #include "simulate-thread.h" 6 7 /* This test verifies writes to globals do not write to adjacent 8 globals. This mostly happens on strict-align targets that are not 9 byte addressable (old Alphas, etc). */ 10 11 char a = 0; 12 char b = 77; 13 simulate_thread_other_threads()14void simulate_thread_other_threads() 15 { 16 } 17 simulate_thread_step_verify()18int simulate_thread_step_verify() 19 { 20 if (b != 77) 21 { 22 printf("FAIL: Unexpected value. <b> is %d, should be 77\n", b); 23 return 1; 24 } 25 return 0; 26 } 27 28 /* Verify that every variable has the correct value. */ simulate_thread_final_verify()29int simulate_thread_final_verify() 30 { 31 int ret = simulate_thread_step_verify (); 32 if (a != 66) 33 { 34 printf("FAIL: Unexpected value. <a> is %d, should be 66\n", a); 35 return 1; 36 } 37 return ret; 38 } 39 40 __attribute__((noinline)) simulate_thread_main()41void simulate_thread_main() 42 { 43 a = 66; 44 } 45 main()46int main () 47 { 48 simulate_thread_main(); 49 simulate_thread_done(); 50 return 0; 51 } 52