1 /* PR target/49244 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -g" } */
4
5 int cnt;
6
7 __attribute__((noinline, noclone)) void
bar(void)8 bar (void)
9 {
10 cnt++;
11 }
12
13 #include "pr49244-1.c"
14
15 int a;
16 long int b;
17 unsigned long int c;
18 unsigned short int d;
19
20 int
main()21 main ()
22 {
23 __atomic_store_n (&a, 15, __ATOMIC_RELAXED);
24 if (f1 (&a, 2) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 15
25 || f1 (&a, 4) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 31)
26 __builtin_abort ();
27 if (f2 (&a, 1) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 31
28 || f2 (&a, 5) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 63)
29 __builtin_abort ();
30 __atomic_store_n (&b, 24, __ATOMIC_RELAXED);
31 if (f3 (&b, 2) != 1 || __atomic_load_n (&b, __ATOMIC_RELAXED) != 28
32 || f3 (&b, 3) != 0 || __atomic_load_n (&b, __ATOMIC_RELAXED) != 28)
33 __builtin_abort ();
34 __atomic_store_n (&a, 0, __ATOMIC_RELAXED);
35 if (f4 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 128
36 || f4 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 128)
37 __builtin_abort ();
38 if (f5 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8320
39 || f5 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8320)
40 __builtin_abort ();
41 if (f6 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321
42 || f6 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
43 __builtin_abort ();
44 if (cnt != 0
45 || (f7 (&a, 7), cnt) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193
46 || (f7 (&a, 7), cnt) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
47 __builtin_abort ();
48 if ((f8 (&a, 7), cnt) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193
49 || (f8 (&a, 7), cnt) != 2 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
50 __builtin_abort ();
51 if (f9 (&a, 13) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 129
52 || f9 (&a, 13) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
53 __builtin_abort ();
54 if (f10 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193
55 || f10 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
56 __builtin_abort ();
57 if (f11 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 129
58 || f11 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
59 __builtin_abort ();
60 if (f12 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8320
61 || f12 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8321)
62 __builtin_abort ();
63 if (f13 (&a, 7) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193
64 || f13 (&a, 7) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193)
65 __builtin_abort ();
66 if (f14 (&a, 13) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 1
67 || f14 (&a, 13) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 1)
68 __builtin_abort ();
69 if (f15 (&a, 0) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 0
70 || f15 (&a, 0) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 0)
71 __builtin_abort ();
72 __atomic_store_n (&a, 8321, __ATOMIC_RELAXED);
73 if (f16 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193
74 || f16 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 8193)
75 __builtin_abort ();
76 if (f17 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 1
77 || f17 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 1)
78 __builtin_abort ();
79 if (f18 (&a) != 1 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 0
80 || f18 (&a) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 0)
81 __builtin_abort ();
82 if (f19 (&c, 7) != 1 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 128
83 || f19 (&c, 7) != 0 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 0)
84 __builtin_abort ();
85 if (f20 (&c) != 0 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 128
86 || f20 (&c) != 1 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 0)
87 __builtin_abort ();
88 __atomic_store_n (&a, 128, __ATOMIC_RELAXED);
89 if (f21 (&a, 4) != 0 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 144
90 || f21 (&a, 4) != 16 || __atomic_load_n (&a, __ATOMIC_RELAXED) != 144)
91 __builtin_abort ();
92 __atomic_store_n (&c, 1, __ATOMIC_RELAXED);
93 if (f22 (&c) != 128 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 129
94 || f22 (&c) != 0 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 1)
95 __builtin_abort ();
96 if (f23 (&c) != 0 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 129
97 || f23 (&c) != 128 || __atomic_load_n (&c, __ATOMIC_RELAXED) != 1)
98 __builtin_abort ();
99 if (f24 (&d) != 0 || __atomic_load_n (&d, __ATOMIC_RELAXED) != 128
100 || f24 (&d) != 1 || __atomic_load_n (&d, __ATOMIC_RELAXED) != 128)
101 __builtin_abort ();
102 __atomic_store_n (&d, 1, __ATOMIC_RELAXED);
103 if (f25 (&d) != 0 || __atomic_load_n (&d, __ATOMIC_RELAXED) != 129
104 || f25 (&d) != 1 || __atomic_load_n (&d, __ATOMIC_RELAXED) != 129
105 || cnt != 2)
106 __builtin_abort ();
107 return 0;
108 }
109