]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/gcc/gcc44-rh533181.patch
firewall: add more pscan matches and filter INVALID conntrack packages.
[ipfire-2.x.git] / src / patches / gcc / gcc44-rh533181.patch
CommitLineData
ed635824
MT
12010-07-22 Jakub Jelinek <jakub@redhat.com>
2
3 * gimplify.c (enum gimplify_omp_var_data): Add
4 GOVD_THREADPRIVATE_WARNED.
5 (gimplify_bind_expr): Add GOVD_LOCAL | GOVD_SEEN even for global vars.
6 (omp_notice_threadprivate_variable): Note used threadprivate vars
7 with current function's context in shared clauses.
8 (gimplify_adjust_omp_clauses_1): Allow globals with current function's
9 context in taskreg shared clause.
10 * omp-low.c (lower_rec_input_clauses): For function-local is_global_var
11 VAR_DECLs in shared clauses add a decl copy with DECL_VALUE_EXPR
12 pointing to the original.
13
14 * trans-openmp.c (gfc_omp_private_debug_clause): Return false for
15 threadprivate decls.
16
17 * gcc.dg/gomp/tls-3.c: New test.
18
19--- gcc/fortran/trans-openmp.c.jj 2010-06-24 21:47:09.908230044 +0200
20+++ gcc/fortran/trans-openmp.c 2010-07-26 10:45:15.830229443 +0200
21@@ -351,6 +351,18 @@ gfc_omp_disregard_value_expr (tree decl,
22 bool
23 gfc_omp_private_debug_clause (tree decl, bool shared)
24 {
25+ if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
26+ {
27+ if (DECL_THREAD_LOCAL_P (decl))
28+ return false;
29+ if (DECL_HAS_VALUE_EXPR_P (decl))
30+ {
31+ tree value = get_base_address (DECL_VALUE_EXPR (decl));
32+ if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value))
33+ return false;
34+ }
35+ }
36+
37 if (GFC_DECL_CRAY_POINTEE (decl))
38 return true;
39
40--- gcc/gimplify.c.jj 2010-07-09 09:01:37.049604412 +0200
41+++ gcc/gimplify.c 2010-07-26 10:50:05.646291216 +0200
42@@ -66,6 +66,7 @@ enum gimplify_omp_var_data
43 GOVD_LOCAL = 128,
44 GOVD_DEBUG_PRIVATE = 256,
45 GOVD_PRIVATE_OUTER_REF = 512,
46+ GOVD_THREADPRIVATE_WARNED = 1024,
47 GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE
48 | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL)
49 };
50@@ -1234,7 +1235,7 @@ gimplify_bind_expr (tree *expr_p, gimple
51 struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
52
53 /* Mark variable as local. */
54- if (ctx && !is_global_var (t)
55+ if (ctx
56 && (! DECL_SEEN_IN_BIND_EXPR_P (t)
57 || splay_tree_lookup (ctx->variables,
58 (splay_tree_key) t) == NULL))
59@@ -5339,18 +5340,36 @@ omp_notice_threadprivate_variable (struc
60 {
61 splay_tree_node n;
62
63- if (ctx->region_type != ORT_UNTIED_TASK)
64+ while (ctx && ctx->region_type == ORT_WORKSHARE)
65+ {
66+ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
67+ if (n != NULL)
68+ {
69+ gcc_assert (n->value & GOVD_LOCAL);
70+ return false;
71+ }
72+ ctx = ctx->outer_context;
73+ }
74+ if (ctx == NULL)
75 return false;
76+
77 n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
78 if (n == NULL)
79+ n = splay_tree_insert (ctx->variables, (splay_tree_key)decl,
80+ DECL_CONTEXT (decl) == current_function_decl
81+ ? GOVD_SHARED | GOVD_SEEN : 0);
82+ if (ctx->region_type == ORT_UNTIED_TASK
83+ && (n->value & GOVD_THREADPRIVATE_WARNED) == 0)
84 {
85 error ("threadprivate variable %qs used in untied task",
86 IDENTIFIER_POINTER (DECL_NAME (decl)));
87 error ("%Henclosing task", &ctx->location);
88- splay_tree_insert (ctx->variables, (splay_tree_key)decl, 0);
89+ n->value |= GOVD_THREADPRIVATE_WARNED;
90 }
91 if (decl2)
92- splay_tree_insert (ctx->variables, (splay_tree_key)decl2, 0);
93+ splay_tree_insert (ctx->variables, (splay_tree_key)decl2,
94+ DECL_CONTEXT (decl2) == current_function_decl
95+ ? GOVD_SHARED | GOVD_SEEN : 0);
96 return false;
97 }
98
99@@ -5779,7 +5798,9 @@ gimplify_adjust_omp_clauses_1 (splay_tre
100 break;
101 ctx = ctx->outer_context;
102 }
103- if (ctx == NULL)
104+ if (ctx == NULL
105+ && (DECL_CONTEXT (decl) != current_function_decl
106+ || gimplify_omp_ctxp->region_type == ORT_WORKSHARE))
107 return 0;
108 }
109 code = OMP_CLAUSE_SHARED;
110--- gcc/omp-low.c.jj 2010-06-11 11:06:00.913659301 +0200
111+++ gcc/omp-low.c 2010-07-26 10:45:15.866229447 +0200
112@@ -2222,6 +2222,17 @@ lower_rec_input_clauses (tree clauses, g
113 continue;
114 break;
115 case OMP_CLAUSE_SHARED:
116+ if (pass == 0
117+ && is_global_var (OMP_CLAUSE_DECL (c))
118+ && (DECL_CONTEXT (OMP_CLAUSE_DECL (c))
119+ == current_function_decl)
120+ && is_taskreg_ctx (ctx)
121+ && !DECL_IGNORED_P (OMP_CLAUSE_DECL (c)))
122+ {
123+ new_var = omp_copy_decl_1 (OMP_CLAUSE_DECL (c), ctx);
124+ SET_DECL_VALUE_EXPR (new_var, OMP_CLAUSE_DECL (c));
125+ DECL_HAS_VALUE_EXPR_P (new_var) = 1;
126+ }
127 if (maybe_lookup_decl (OMP_CLAUSE_DECL (c), ctx) == NULL)
128 {
129 gcc_assert (is_global_var (OMP_CLAUSE_DECL (c)));
130--- gcc/testsuite/gcc.dg/gomp/tls-3.c.jj 2010-07-26 10:45:15.868228753 +0200
131+++ gcc/testsuite/gcc.dg/gomp/tls-3.c 2010-07-26 10:45:15.868228753 +0200
132@@ -0,0 +1,21 @@
133+/* { dg-do compile } */
134+/* { dg-require-effective-target tls_native } */
135+
136+int thr;
137+#pragma omp threadprivate(thr)
138+
139+void
140+foo (void)
141+{
142+ #pragma omp task untied /* { dg-error "enclosing task" } */
143+ {
144+ static int thr2;
145+ #pragma omp threadprivate(thr2)
146+ static int thr3;
147+ #pragma omp threadprivate(thr3)
148+ thr++; /* { dg-error "used in untied task" } */
149+ thr2++; /* { dg-error "used in untied task" } */
150+ thr++;
151+ thr2++;
152+ }
153+}