c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / c-c++-common / simulate-thread / bitfields-3.c
blob5d2feed9f034a20c9db08572ff100865c24138ac
1 /* { dg-do link } */
2 /* { dg-options "-fno-allow-store-data-races" } */
3 /* { dg-final { simulate-thread } } */
5 #include <stdio.h>
6 #include "../../gcc.dg/simulate-thread/simulate-thread.h"
8 /* Store into <c> should not clobber <d>. */
10 struct bits
12 char a;
13 int b:7;
14 int c:9;
15 unsigned char d;
16 } var;
18 static int global = 0;
20 void simulate_thread_other_threads()
22 global++;
23 var.d = global;
26 int simulate_thread_step_verify()
28 if (var.d != global)
30 printf("FAIL: invalid intermediate result\n");
31 return 1;
33 return 0;
36 int simulate_thread_final_verify()
38 if (var.c != 5)
40 printf("FAIL: invalid final result\n");
41 return 1;
43 return 0;
46 __attribute__((noinline))
47 void update_c(struct bits *p, int val)
49 p -> c = val;
52 __attribute__((noinline))
53 void simulate_thread_main()
55 update_c(&var, 5);
58 int main()
60 simulate_thread_main();
61 simulate_thread_done();
62 return 0;