aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/pr83945.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/pr83945.c')
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr83945.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/pr83945.c b/gcc/testsuite/gcc.dg/tls/pr83945.c
new file mode 100644
index 00000000000..dade2388eea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr83945.c
@@ -0,0 +1,21 @@
+/* PR middle-end/83945 */
+/* { dg-do compile { target tls } } */
+/* { dg-options "-O2" } */
+
+struct S { int a[1]; };
+__thread struct T { int c; } e;
+int f;
+void bar (int);
+
+void
+foo (int f, int x)
+{
+ struct S *h = (struct S *) &e.c;
+ for (;;)
+ {
+ int *a = h->a, i;
+ for (i = x; i; i--)
+ bar (a[f]);
+ bar (a[f]);
+ }
+}