PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / simulate-thread / strict-align-global.c
blobf8b88ada03d539275084d0a95b89e563fd9847c2
1 /* { dg-do link } */
2 /* { dg-final { simulate-thread } } */
4 #include <stdio.h>
5 #include "simulate-thread.h"
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). */
11 char a = 0;
12 char b = 77;
14 void simulate_thread_other_threads()
18 int simulate_thread_step_verify()
20 if (b != 77)
22 printf("FAIL: Unexpected value. <b> is %d, should be 77\n", b);
23 return 1;
25 return 0;
28 /* Verify that every variable has the correct value. */
29 int simulate_thread_final_verify()
31 int ret = simulate_thread_step_verify ();
32 if (a != 66)
34 printf("FAIL: Unexpected value. <a> is %d, should be 66\n", a);
35 return 1;
37 return ret;
40 __attribute__((noinline))
41 void simulate_thread_main()
43 a = 66;
46 int main ()
48 simulate_thread_main();
49 simulate_thread_done();
50 return 0;