summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/pr45870.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/pr45870.c')
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr45870.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/pr45870.c b/gcc/testsuite/gcc.dg/tls/pr45870.c
new file mode 100644
index 000000000..8a5d3c74a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr45870.c
@@ -0,0 +1,21 @@
+/* PR target/45870 */
+/* { dg-do compile } */
+/* { dg-options "-g -O" } */
+/* { dg-require-effective-target tls } */
+
+__thread int v[30];
+int bar (void);
+
+int
+foo (int x, int y, int z)
+{
+ int a, b = z, c;
+ while (b > 0)
+ {
+ c = (bar () % 3);
+ a = v[x];
+ if (x < y)
+ for (;;);
+ b += a;
+ }
+}