summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/opt-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/opt-9.c')
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-9.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/opt-9.c b/gcc/testsuite/gcc.dg/tls/opt-9.c
new file mode 100644
index 000000000..49aa9085f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/opt-9.c
@@ -0,0 +1,9 @@
+/* PR 21412 */
+/* { dg-do compile */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target tls } */
+
+struct S { int x[10]; };
+extern __thread struct S s;
+int *foo() { return &s.x[2]; }