(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr103721-2.c
       1  // { dg-do run }
       2  // { dg-options "-O2" }
       3  
       4  extern void abort ();
       5  struct S { int x; } a[10];
       6  struct S *b;
       7  
       8  int
       9  main ()
      10  {
      11    int i, j = 0;
      12    struct S *q = a;
      13  
      14    for (i = 100; --i > 0; )
      15      {
      16        struct S *p;
      17        j++;
      18        if (j >= 10)
      19          j = 0;
      20        p = &a[j];
      21  
      22        if (p == q)
      23          abort ();
      24        __atomic_thread_fence (__ATOMIC_SEQ_CST);
      25        q = p;
      26      }
      27    return 0;
      28  }