aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/pr78796.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/pr78796.c')
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr78796.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/pr78796.c b/gcc/testsuite/gcc.dg/tls/pr78796.c
new file mode 100644
index 00000000000..12263da9bb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr78796.c
@@ -0,0 +1,32 @@
+/* PR target/78796 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mcmodel=large" { target aarch64-*-* } } */
+/* { dg-require-effective-target tls } */
+
+struct S { int a, b, c, d, e; };
+struct S t;
+__thread struct S s;
+
+__attribute__((used, noinline, noclone)) void
+foo (int *x, int *y)
+{
+ asm volatile ("" : : "g" (x), "g" (y) : "memory");
+ if (*x != 1 || *y != 2)
+ __builtin_abort ();
+}
+
+__attribute__((used, noinline, noclone)) void
+bar (void)
+{
+ foo (&t.c, &s.c);
+}
+
+int
+main ()
+{
+ t.c = 1;
+ s.c = 2;
+ bar ();
+ return 0;
+}