aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/obsolete/gcc/gcc-4.3.2/fedora/gcc43-pr35751.patch
blob: 37b84275e24bb353de124139c12ddb1be595e78d (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
2008-04-03  Jakub Jelinek  <jakub@redhat.com>

	PR c/35751
	* c-decl.c (finish_decl): If extern or static var has variable
	size, set TREE_TYPE (decl) to error_mark_node.

	* decl.c (layout_var_decl): If extern or static var has variable
	size, set TREE_TYPE (decl) to error_mark_node.

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

--- gcc/c-decl.c.jj	2008-04-03 09:41:42.000000000 +0200
+++ gcc/c-decl.c	2008-04-03 18:20:52.000000000 +0200
@@ -3481,7 +3481,10 @@ finish_decl (tree decl, tree init, tree 
 	  if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
 	    constant_expression_warning (DECL_SIZE (decl));
 	  else
-	    error ("storage size of %q+D isn%'t constant", decl);
+	    {
+	      error ("storage size of %q+D isn%'t constant", decl);
+	      TREE_TYPE (decl) = error_mark_node;
+	    }
 	}
 
       if (TREE_USED (type))
--- gcc/cp/decl.c.jj	2008-03-31 23:54:40.000000000 +0200
+++ gcc/cp/decl.c	2008-04-03 18:30:19.000000000 +0200
@@ -4442,7 +4442,10 @@ layout_var_decl (tree decl)
       if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
 	constant_expression_warning (DECL_SIZE (decl));
       else
-	error ("storage size of %qD isn't constant", decl);
+	{
+	  error ("storage size of %qD isn't constant", decl);
+	  TREE_TYPE (decl) = error_mark_node;
+	}
     }
 }
 
--- gcc/testsuite/gcc.dg/gomp/pr35751.c.jj	2008-04-03 18:26:12.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/pr35751.c	2008-04-03 18:25:51.000000000 +0200
@@ -0,0 +1,34 @@
+/* PR c/35751 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (int i)
+{
+  extern int a[i];	/* { dg-error "must have no linkage|storage size of" } */
+  static int b[i];	/* { dg-error "storage size of" } */
+
+#pragma omp parallel
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel shared (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel private (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel firstprivate (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+}
--- gcc/testsuite/g++.dg/gomp/pr35751.C.jj	2008-04-03 18:32:13.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/pr35751.C	2008-04-03 18:32:32.000000000 +0200
@@ -0,0 +1,34 @@
+// PR c/35751
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void
+foo (int i)
+{
+  extern int a[i];	// { dg-error "storage size of" }
+  static int b[i];	// { dg-error "storage size of" }
+
+#pragma omp parallel
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel shared (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel private (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+
+#pragma omp parallel firstprivate (a, b)
+  {
+    a[0] = 0;
+    b[0] = 0;
+  }
+}