summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/sync-1.c
blob: ad85a04b398be89f8a003a211901c5844de17b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-do run } */
/* { dg-options "-O2 -march=armv7-a" } */

volatile int mem;

int
bar (int x, int y)
{
  if (x)
    __sync_fetch_and_add(&mem, y);
  return 0;
}

extern void abort (void);

int
main (int argc, char *argv[])
{
  mem = 0;
  bar (0, 1);
  bar (1, 1);
  if (mem != 1)
    abort ();
  return 0;
}