1 2002-07-30 Jakub Jelinek <jakub@redhat.com>
3 * expr.c (expand_expr) [ADDR_EXPR]: Force addresses of thread-local
6 * gcc.dg/tls/opt-1.c: New test.
8 --- gcc/testsuite/gcc.dg/tls/opt-1.c.jj 2002-07-30 13:57:33.000000000 +0200
9 +++ gcc/testsuite/gcc.dg/tls/opt-1.c 2002-07-30 13:56:40.000000000 +0200
11 +/* { dg-do compile } */
12 +/* { dg-options "-O2 -fPIC" } */
13 +/* { dg-options "-O2 -fPIC -mcpu=i686" { target i?86-*-* } } */
15 +extern __thread int thr;
27 +__attribute__ ((regparm (3)))
29 +foo (const char *x, void *y, int *z)
35 +test (const char *x, void *y)
39 --- gcc/expr.c.jj 2002-07-30 12:49:43.000000000 +0200
40 +++ gcc/expr.c 2002-07-30 20:18:36.000000000 +0200
41 @@ -8833,7 +8833,12 @@ expand_expr (exp, target, tmode, modifie
42 op0 = force_operand (XEXP (op0, 0), target);
46 + if ((flag_force_addr
47 + || (TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
48 + && DECL_THREAD_LOCAL (TREE_OPERAND (exp, 0))
49 + && ! memory_address_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp,
52 && GET_CODE (op0) != REG
53 && modifier != EXPAND_CONST_ADDRESS
54 && modifier != EXPAND_INITIALIZER