~ubuntu-branches/debian/sid/gnat-4.4/sid

« back to all changes in this revision

Viewing changes to debian/patches/pr43893.diff

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2010-05-09 23:28:13 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100509232813-bykj33gg0mc34opr
Tags: 4.4.4-2
* debian/control.m4, debian/control: make upgrades from Lenny work without
  broken packages or hard decisions.
  (gnat-4.4): replace all previous versions of gnat-X.Y.
  (libgnat{vsn,prj}4.4-dev):
  - Replace the corresponding 4.3 package in addition to Conflicting with it.
  - Suggest the -dbg package, too.
  (libgnat{vsn,prj}4.4-dbg):
  - Depend on the -dev package, too.
  - Do not recommend gnat-gdb, superseded by gdb.
  (libgnatprj4.4-dbg): do not recommend libgnatprj-dev, no longer in the archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
gcc/
 
2
 
 
3
2010-04-26  Jakub Jelinek  <jakub@redhat.com>
 
4
 
 
5
        PR c/43893
 
6
        * c-omp.c (c_finish_omp_for): Handle also EQ_EXPR.
 
7
 
 
8
libgomp/
 
9
 
 
10
2010-04-26  Jakub Jelinek  <jakub@redhat.com>
 
11
 
 
12
        PR c/43893
 
13
        * testsuite/libgomp.c/pr43893.c: New test.
 
14
        * testsuite/libgomp.c++/pr43893.C: New test.
 
15
 
 
16
 
 
17
Index: libgomp/testsuite/libgomp.c++/pr43893.C
 
18
===================================================================
 
19
--- a/src/libgomp/testsuite/libgomp.c++/pr43893.C       (revision 0)
 
20
+++ b/src/libgomp/testsuite/libgomp.c++/pr43893.C       (revision 158746)
 
21
@@ -0,0 +1,125 @@
 
22
+// PR c/43893
 
23
+// { dg-do run }
 
24
+
 
25
+extern "C" void abort ();
 
26
+
 
27
+template <typename T, T M, T N>
 
28
+void
 
29
+f1 ()
 
30
+{
 
31
+  int c;
 
32
+  T i;
 
33
+  c = 0;
 
34
+#pragma omp parallel for reduction(+:c)
 
35
+  for (i = M; i < N; i++)
 
36
+    c++;
 
37
+  if (c != 1)
 
38
+    abort ();
 
39
+}
 
40
+
 
41
+template <typename T, T M, T N>
 
42
+void
 
43
+f2 ()
 
44
+{
 
45
+  int c;
 
46
+  T i;
 
47
+  c = 0;
 
48
+#pragma omp parallel for reduction(+:c)
 
49
+  for (i = M; i <= N; i++)
 
50
+    c++;
 
51
+  if (c != 1)
 
52
+    abort ();
 
53
+}
 
54
+
 
55
+template <typename T, T M, T N>
 
56
+void
 
57
+f3 ()
 
58
+{
 
59
+  int c;
 
60
+  T i;
 
61
+  c = 0;
 
62
+#pragma omp parallel for reduction(+:c)
 
63
+  for (i = M; i > N; i--)
 
64
+    c++;
 
65
+  if (c != 1)
 
66
+    abort ();
 
67
+}
 
68
+
 
69
+template <typename T, T M, T N>
 
70
+void
 
71
+f4 ()
 
72
+{
 
73
+  int c;
 
74
+  T i;
 
75
+  c = 0;
 
76
+#pragma omp parallel for reduction(+:c)
 
77
+  for (i = M; i >= N; i--)
 
78
+    c++;
 
79
+  if (c != 1)
 
80
+    abort ();
 
81
+}
 
82
+
 
83
+int
 
84
+main ()
 
85
+{
 
86
+  int c;
 
87
+  unsigned int i;
 
88
+  int j;
 
89
+  c = 0;
 
90
+#pragma omp parallel for reduction(+:c)
 
91
+  for (i = 0; i < 1; i++)
 
92
+    c++;
 
93
+  if (c != 1)
 
94
+    abort ();
 
95
+  f1 <unsigned int, 0, 1> ();
 
96
+  c = 0;
 
97
+#pragma omp parallel for reduction(+:c)
 
98
+  for (i = 0; i <= 0; i++)
 
99
+    c++;
 
100
+  if (c != 1)
 
101
+    abort ();
 
102
+  f2 <unsigned int, 0, 0> ();
 
103
+  c = 0;
 
104
+#pragma omp parallel for reduction(+:c)
 
105
+  for (j = - __INT_MAX__ - 1; j < - __INT_MAX__; j++)
 
106
+    c++;
 
107
+  if (c != 1)
 
108
+    abort ();
 
109
+  f1 <int, (- __INT_MAX__ - 1), (- __INT_MAX__)> ();
 
110
+  c = 0;
 
111
+#pragma omp parallel for reduction(+:c)
 
112
+  for (j = - __INT_MAX__ - 1; j <= - __INT_MAX__ - 1; j++)
 
113
+    c++;
 
114
+  if (c != 1)
 
115
+    abort ();
 
116
+  f2 <int, (- __INT_MAX__ - 1), (- __INT_MAX__ - 1)> ();
 
117
+  c = 0;
 
118
+#pragma omp parallel for reduction(+:c)
 
119
+  for (i = 2U * __INT_MAX__ + 1; i > 2U * __INT_MAX__; i--)
 
120
+    c++;
 
121
+  if (c != 1)
 
122
+    abort ();
 
123
+  f3 <unsigned int, (2U * __INT_MAX__ + 1), (2U * __INT_MAX__)> ();
 
124
+  c = 0;
 
125
+#pragma omp parallel for reduction(+:c)
 
126
+  for (i = 2U * __INT_MAX__ + 1; i >= 2U * __INT_MAX__ + 1; i--)
 
127
+    c++;
 
128
+  if (c != 1)
 
129
+    abort ();
 
130
+  f4 <unsigned int, (2U * __INT_MAX__ + 1), (2U * __INT_MAX__ + 1)> ();
 
131
+  c = 0;
 
132
+#pragma omp parallel for reduction(+:c)
 
133
+  for (j = __INT_MAX__; j > __INT_MAX__ - 1; j--)
 
134
+    c++;
 
135
+  if (c != 1)
 
136
+    abort ();
 
137
+  f3 <int, __INT_MAX__, (__INT_MAX__ - 1)> ();
 
138
+  c = 0;
 
139
+#pragma omp parallel for reduction(+:c)
 
140
+  for (j = __INT_MAX__; j >= __INT_MAX__; j--)
 
141
+    c++;
 
142
+  if (c != 1)
 
143
+    abort ();
 
144
+  f4 <int, __INT_MAX__, __INT_MAX__> ();
 
145
+  return 0;
 
146
+}
 
147
Index: libgomp/testsuite/libgomp.c/pr43893.c
 
148
===================================================================
 
149
--- a/src/libgomp/testsuite/libgomp.c/pr43893.c (revision 0)
 
150
+++ b/src/libgomp/testsuite/libgomp.c/pr43893.c (revision 158746)
 
151
@@ -0,0 +1,61 @@
 
152
+/* PR c/43893 */
 
153
+/* { dg-do run } */
 
154
+
 
155
+extern void abort (void);
 
156
+
 
157
+int
 
158
+main ()
 
159
+{
 
160
+  int c;
 
161
+  unsigned int i;
 
162
+  int j;
 
163
+  c = 0;
 
164
+#pragma omp parallel for reduction(+:c)
 
165
+  for (i = 0; i < 1; i++)
 
166
+    c++;
 
167
+  if (c != 1)
 
168
+    abort ();
 
169
+  c = 0;
 
170
+#pragma omp parallel for reduction(+:c)
 
171
+  for (i = 0; i <= 0; i++)
 
172
+    c++;
 
173
+  if (c != 1)
 
174
+    abort ();
 
175
+  c = 0;
 
176
+#pragma omp parallel for reduction(+:c)
 
177
+  for (j = - __INT_MAX__ - 1; j < - __INT_MAX__; j++)
 
178
+    c++;
 
179
+  if (c != 1)
 
180
+    abort ();
 
181
+  c = 0;
 
182
+#pragma omp parallel for reduction(+:c)
 
183
+  for (j = - __INT_MAX__ - 1; j <= - __INT_MAX__ - 1; j++)
 
184
+    c++;
 
185
+  if (c != 1)
 
186
+    abort ();
 
187
+  c = 0;
 
188
+#pragma omp parallel for reduction(+:c)
 
189
+  for (i = 2U * __INT_MAX__ + 1; i > 2U * __INT_MAX__; i--)
 
190
+    c++;
 
191
+  if (c != 1)
 
192
+    abort ();
 
193
+  c = 0;
 
194
+#pragma omp parallel for reduction(+:c)
 
195
+  for (i = 2U * __INT_MAX__ + 1; i >= 2U * __INT_MAX__ + 1; i--)
 
196
+    c++;
 
197
+  if (c != 1)
 
198
+    abort ();
 
199
+  c = 0;
 
200
+#pragma omp parallel for reduction(+:c)
 
201
+  for (j = __INT_MAX__; j > __INT_MAX__ - 1; j--)
 
202
+    c++;
 
203
+  if (c != 1)
 
204
+    abort ();
 
205
+  c = 0;
 
206
+#pragma omp parallel for reduction(+:c)
 
207
+  for (j = __INT_MAX__; j >= __INT_MAX__; j--)
 
208
+    c++;
 
209
+  if (c != 1)
 
210
+    abort ();
 
211
+  return 0;
 
212
+}
 
213
Index: gcc/c-omp.c
 
214
===================================================================
 
215
--- a/src/gcc/c-omp.c   (revision 158745)
 
216
+++ b/src/gcc/c-omp.c   (revision 158746)
 
217
@@ -1,7 +1,7 @@
 
218
 /* This file contains routines to construct GNU OpenMP constructs,
 
219
    called from parsing in the C and C++ front ends.
 
220
 
 
221
-   Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
 
222
+   Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
223
    Contributed by Richard Henderson <rth@redhat.com>,
 
224
                  Diego Novillo <dnovillo@redhat.com>.
 
225
 
 
226
@@ -301,7 +301,8 @@
 
227
              || TREE_CODE (cond) == LE_EXPR
 
228
              || TREE_CODE (cond) == GT_EXPR
 
229
              || TREE_CODE (cond) == GE_EXPR
 
230
-             || TREE_CODE (cond) == NE_EXPR)
 
231
+             || TREE_CODE (cond) == NE_EXPR
 
232
+             || TREE_CODE (cond) == EQ_EXPR)
 
233
            {
 
234
              tree op0 = TREE_OPERAND (cond, 0);
 
235
              tree op1 = TREE_OPERAND (cond, 1);
 
236
@@ -346,18 +347,21 @@
 
237
                  cond_ok = true;
 
238
                }
 
239
 
 
240
-             if (TREE_CODE (cond) == NE_EXPR)
 
241
+             if (TREE_CODE (cond) == NE_EXPR
 
242
+                 || TREE_CODE (cond) == EQ_EXPR)
 
243
                {
 
244
                  if (!INTEGRAL_TYPE_P (TREE_TYPE (decl)))
 
245
                    cond_ok = false;
 
246
                  else if (operand_equal_p (TREE_OPERAND (cond, 1),
 
247
                                            TYPE_MIN_VALUE (TREE_TYPE (decl)),
 
248
                                            0))
 
249
-                   TREE_SET_CODE (cond, GT_EXPR);
 
250
+                   TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR
 
251
+                                        ? GT_EXPR : LE_EXPR);
 
252
                  else if (operand_equal_p (TREE_OPERAND (cond, 1),
 
253
                                            TYPE_MAX_VALUE (TREE_TYPE (decl)),
 
254
                                            0))
 
255
-                   TREE_SET_CODE (cond, LT_EXPR);
 
256
+                   TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR
 
257
+                                        ? LT_EXPR : GE_EXPR);
 
258
                  else
 
259
                    cond_ok = false;
 
260
                }