diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-06 07:25:02 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-06 07:25:02 +0000 |
commit | 8d3480ed2a123c54de409c907670a11e811c1b8e (patch) | |
tree | 06aa32ae359e2b332fbb0a1059962011090120d6 /gcc | |
parent | a3f2c0e135878a1619eaa1be28651e3bbb137083 (diff) | |
download | gcc-8d3480ed2a123c54de409c907670a11e811c1b8e.tar.gz |
PR target/29198
* config/i386/i386.c (legitimize_pic_address): Reject TLS symbols.
* config/i386/predicates.md (local_symbolic_operand): Likewise.
* gcc.dg/tls/opt-12.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 2 | ||||
-rw-r--r-- | gcc/config/i386/predicates.md | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/opt-12.c | 50 |
5 files changed, 61 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eaecfedff3..59bafdec7ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2006-10-06 Jakub Jelinek <jakub@redhat.com> + PR target/29198 + * config/i386/i386.c (legitimize_pic_address): Reject TLS symbols. + * config/i386/predicates.md (local_symbolic_operand): Likewise. + PR c/29091 * varasm.c (output_constant): If TREE_VECTOR_CST_ELTS chain is shorter than the number of vector elements fill the rest with zeros. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cdbd0c658c5..287163e8e0e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6623,7 +6623,7 @@ legitimize_pic_address (rtx orig, rtx reg) new = reg; } } - else if (GET_CODE (addr) == SYMBOL_REF) + else if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (addr) == 0) { if (TARGET_64BIT) { diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 457f5563a7b..52011918100 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -447,6 +447,9 @@ if (GET_CODE (op) != SYMBOL_REF) return 0; + if (SYMBOL_REF_TLS_MODEL (op) != 0) + return 0; + if (SYMBOL_REF_LOCAL_P (op)) return 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce15a0f56e5..5027cb4f571 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2006-10-06 Jakub Jelinek <jakub@redhat.com> + PR target/29198 + * gcc.dg/tls/opt-12.c: New test. + PR fortran/28415 * gfortran.dg/save_2.f90: New test. diff --git a/gcc/testsuite/gcc.dg/tls/opt-12.c b/gcc/testsuite/gcc.dg/tls/opt-12.c new file mode 100644 index 00000000000..7c6e73430a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/opt-12.c @@ -0,0 +1,50 @@ +/* PR target/29198 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-require-effective-target fpic } */ + +extern void abort (void); + +int f2 (int, int, int, int); +struct s { char b[4]; }; +__thread struct s thra[2]; + +void +__attribute__((noinline)) +f1 (int a1, int a2) +{ + int i, j; + for (i = 0; i < 4; i++) + { + int tot = 0; + for (j = 0; j < 4; j++) + tot += f2 (a1, a2, i, j); + *(&thra[0].b[0] + i) = tot; + } +} + +int +__attribute__((noinline)) +f2 (int a, int b, int c, int d) +{ + return a + b + c + d; +} + +int +main (void) +{ + f1 (0, 0); + if (thra[0].b[0] != 6 + || thra[0].b[1] != 10 + || thra[0].b[2] != 14 + || thra[0].b[3] != 18) + abort (); + f1 (2, 3); + if (thra[0].b[0] != 26 + || thra[0].b[1] != 30 + || thra[0].b[2] != 34 + || thra[0].b[3] != 38) + abort (); + return 0; +} |