Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 | |
14 void simulate_thread_other_threads() | |
15 { | |
16 } | |
17 | |
18 int 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. */ | |
29 int 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)) | |
41 void simulate_thread_main() | |
42 { | |
43 a = 66; | |
44 } | |
45 | |
46 int main () | |
47 { | |
48 simulate_thread_main(); | |
49 simulate_thread_done(); | |
50 return 0; | |
51 } |