Debian Codegraph @

gcc/testsuite/gcc.dg/atomic/pr118137.c

raw
1 /* Test that subword atomic operations only affect the subword. */
2 /* { dg-do run } */
3 /* { dg-require-effective-target sync_char_short } */
4
5 void
6 foo (char *x)
7 {
8 __sync_fetch_and_or (x, 0xff);
9 }
10
11 void
12 bar (short *y)
13 {
14 __atomic_fetch_or (y, 0xffff, 0);
15 }
16
17
18 int
19 main ()
20 {
21 char b[4] = {};
22 foo(b);
23
24 short h[2] = {};
25 bar(h);
26
27 if (b[1] || b[2] || b[3] || h[1])
28 __builtin_abort();
29 }