]> git.pld-linux.org Git - packages/gcc.git/blob - gcc32-tls2.patch
- ported to gcc 3.3
[packages/gcc.git] / gcc32-tls2.patch
1 2002-07-30  Jakub Jelinek  <jakub@redhat.com>
2
3         * expr.c (expand_expr) [ADDR_EXPR]: Force addresses of thread-local
4         variables into pseudo.
5
6         * gcc.dg/tls/opt-1.c: New test.
7
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
10 @@ -0,0 +1,28 @@
11 +/* { dg-do compile } */
12 +/* { dg-options "-O2 -fPIC" } */
13 +/* { dg-options "-O2 -fPIC -mcpu=i686" { target i?86-*-* } } */
14 +
15 +extern __thread int thr;
16 +
17 +static int x;
18 +
19 +static void
20 +bar (void)
21 +{
22 +  x = 1;
23 +}
24 +
25 +static void
26 +#ifdef __i386__
27 +__attribute__ ((regparm (3)))
28 +#endif
29 +foo (const char *x, void *y, int *z)
30 +{
31 +  bar ();
32 +}
33 +
34 +void
35 +test (const char *x, void *y)
36 +{
37 +  foo (x, y, &thr);
38 +}
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);
43         }
44  
45 -      if (flag_force_addr
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,
50 +                                                                         0))),
51 +                                     op0)))
52           && GET_CODE (op0) != REG
53           && modifier != EXPAND_CONST_ADDRESS
54           && modifier != EXPAND_INITIALIZER
This page took 0.028548 seconds and 3 git commands to generate.