re PR target/29198 (Incorrect reference to __thread array with -fPIC -O2 on x86)
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. From-SVN: r117483
This commit is contained in:
parent
9eccb94dff
commit
c1a46941d4
5 changed files with 61 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
50
gcc/testsuite/gcc.dg/tls/opt-12.c
Normal file
50
gcc/testsuite/gcc.dg/tls/opt-12.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue