* gcc.dg/tls/struct-1.c: New test.
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Sep 2002 20:03:40 +0000 (20:03 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Sep 2002 20:03:40 +0000 (20:03 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57367 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tls/struct-1.c [new file with mode: 0644]

index eccae63..85bebe0 100644 (file)
@@ -1,3 +1,7 @@
+2002-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/tls/struct-1.c: New test.
+
 2002-09-20  Neil Booth  <neil@daikokuya.co.uk>
 
        * gcc.dg/cpp/tr-warn2.c: Update.
diff --git a/gcc/testsuite/gcc.dg/tls/struct-1.c b/gcc/testsuite/gcc.dg/tls/struct-1.c
new file mode 100644 (file)
index 0000000..1115123
--- /dev/null
@@ -0,0 +1,32 @@
+/* This testcase ICEd on IA-32 because the backend was inconsistent whether
+   to allow addends for @dtpoff relocs or not.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic" } */
+
+struct S {
+  int s0, s1, s2, s3;
+};
+static __thread struct S x;
+extern void abort (void);
+extern void exit (int);
+
+void
+foo (struct S *s)
+{
+  s->s2 = 231;
+}
+
+void
+bar (void)
+{
+  if (x.s0 == 231 || x.s2 != 231)
+    abort ();
+}
+
+int
+main ()
+{
+  foo (&x);
+  bar ();
+  exit (0);
+}