summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0166-PR-c-48716.patch
blob: c9c474d6016ffd26b4a735993317ad57b2d7ffb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Upstream-Status: Inappropriate [Backport]
From 3a3d51cb4f1ec33265471b03d21b96d30e899858 Mon Sep 17 00:00:00 2001
From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Apr 2011 14:11:44 +0000
Subject: [PATCH 166/200] 	PR c/48716
 	* gimplify.c (gimplify_bind_expr): Mark as GOVD_LOCAL also
 	TREE_STATIC variables declared inside of some OpenMP construct.

	* gcc.dg/gomp/pr48716.c: New test.
	* g++.dg/gomp/pr48716.C: New test.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172860 138bc75d-0d04-0410-961f-82ee72b054a4

index 400493f..908d736 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1138,7 +1138,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
 	  struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
 
 	  /* Mark variable as local.  */
-	  if (ctx && !is_global_var (t)
+	  if (ctx && !DECL_EXTERNAL (t)
 	      && (! DECL_SEEN_IN_BIND_EXPR_P (t)
 		  || splay_tree_lookup (ctx->variables,
 					(splay_tree_key) t) == NULL))
new file mode 100644
index 0000000..2dccad2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr48716.C
@@ -0,0 +1,24 @@
+// PR c/48716
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+int
+main (void)
+{
+  #pragma omp parallel default(none)
+  {
+    static int s;
+    int t = 0;
+    #pragma omp atomic
+    s++;
+    t++;
+  }
+  #pragma omp task default(none)
+  {
+    static int s;
+    int t = 0;
+    #pragma omp atomic
+    s++;
+    t++;
+  }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr48716.c b/gcc/testsuite/gcc.dg/gomp/pr48716.c
new file mode 100644
index 0000000..3496e2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr48716.c
@@ -0,0 +1,24 @@
+/* PR c/48716 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+int
+main (void)
+{
+  #pragma omp parallel default(none)
+  {
+    static int s;
+    int t = 0;
+    #pragma omp atomic
+    s++;
+    t++;
+  }
+  #pragma omp task default(none)
+  {
+    static int s;
+    int t = 0;
+    #pragma omp atomic
+    s++;
+    t++;
+  }
+}
-- 
1.7.0.4

OpenPOWER on IntegriCloud