summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr94368.c
blob: 1267b8220983ef1477a8339bdcc6369abaeca592 (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
/* PR target/94368 */
/* { dg-do compile { target fpic } } */
/* { dg-options "-fpic -O1 -fcommon" } */

int b, c, d, e, f, h;
short g;
int foo (int) __attribute__ ((__const__));

void
bar (void)
{
  while (1)
    {
      while (1)
	{
	  __atomic_load_n (&e, 0);
	  if (foo (2))
	    __sync_val_compare_and_swap (&c, 0, f);
	  b = 1;
	  if (h == e)
	    break;
	}
      __sync_val_compare_and_swap (&g, -1, f);
    }
}