diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls/struct-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/struct-1.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/struct-1.c b/gcc/testsuite/gcc.dg/tls/struct-1.c new file mode 100644 index 000000000..fbe3e3c10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/struct-1.c @@ -0,0 +1,34 @@ +/* This testcase ICEd on IA-32 because the backend was inconsistent whether + to allow addends for @dtpoff relocs or not. */ +/* { dg-do compile } */ +/* { dg-require-effective-target fpic } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-require-effective-target tls } */ + +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); +} |