summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/tls-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/debug/tls-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/debug/tls-1.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/debug/tls-1.c b/gcc/testsuite/gcc.dg/debug/tls-1.c
new file mode 100644
index 00000000000..a9431ef00b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/tls-1.c
@@ -0,0 +1,19 @@
+/* Test that optimized out __thread var doesn't have its location
+ referenced in debug info. */
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+
+static __thread int vara;
+
+int
+foo (int b)
+{
+ return vara + b;
+}
+
+int
+main (void)
+{
+ return foo (0);
+}