(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tls/
pr78796.c
       1  /* PR target/78796 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O2" } */
       4  /* { dg-additional-options "-mcmodel=large -fno-pie -no-pie" { target aarch64-*-* } } */
       5  /* { dg-require-effective-target tls_runtime } */
       6  /* { dg-add-options tls } */
       7  
       8  struct S { int a, b, c, d, e; };
       9  struct S t;
      10  __thread struct S s;
      11  
      12  __attribute__((used, noinline, noclone)) void
      13  foo (int *x, int *y)
      14  {
      15    asm volatile ("" : : "g" (x), "g" (y) : "memory");
      16    if (*x != 1 || *y != 2)
      17      __builtin_abort ();
      18  }
      19  
      20  __attribute__((used, noinline, noclone)) void
      21  bar (void)
      22  {
      23    foo (&t.c, &s.c);
      24  }
      25  
      26  int
      27  main ()
      28  {
      29    t.c = 1;
      30    s.c = 2;
      31    bar ();
      32    return 0;
      33  }