summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/thr-init-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/thr-init-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/tls/thr-init-2.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/thr-init-2.c b/gcc/testsuite/gcc.dg/tls/thr-init-2.c
new file mode 100644
index 000000000..22c96ea9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/thr-init-2.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
+
+extern void abort() ;
+
+static __thread int fstat ;
+static __thread int fstat = 1;
+
+int test_code(int b)
+{
+ fstat += b ;
+ return fstat;
+}
+
+int main (int ac, char *av[])
+{
+ int a = test_code(1);
+
+ if ((a != 2) || (fstat != 2))
+ abort () ;
+
+ return 0;
+}