Contents of /trunk/gcc/patches/gcc-5.1.0-gomp-fixes.patch
Parent Directory
|
Revision Log
Revision 2571 -
(show annotations)
(download)
Wed Jun 10 08:34:21 2015 UTC (8 years, 11 months ago) by niro
File size: 72838 byte(s)
Wed Jun 10 08:34:21 2015 UTC (8 years, 11 months ago) by niro
File size: 72838 byte(s)
-upstream gomp fixes
1 | Submitted By: Bruce Dubbs <bdubbs@liinuxfromscratch.org> |
2 | Date: 2015-05-23 |
3 | Initial Package Version: 5.1.0 |
4 | Upstream Status: Committed |
5 | Origin: https://patchwork.ozlabs.org/patch/469768/raw/ and |
6 | gcc git |
7 | Description: Fix acc_device_type not distinguishing between |
8 | "offloaded" and host code with the host_nonshm plugin. |
9 | Fix inline issues. |
10 | |
11 | commit adccf2e7d313263d585f63e752a4d36653d47811 |
12 | Author: Julian Brown <julian@codesourcery.com> |
13 | Date: Tue Apr 21 12:40:45 2015 -0700 |
14 | |
15 | Non-SHM acc_on_device fixes |
16 | |
17 | diff --git a/gcc/builtins.c b/gcc/builtins.c |
18 | index 6fe1456..5930fe4 100644 |
19 | --- a/gcc/builtins.c |
20 | +++ b/gcc/builtins.c |
21 | @@ -5917,6 +5917,7 @@ expand_stack_save (void) |
22 | static rtx |
23 | expand_builtin_acc_on_device (tree exp, rtx target) |
24 | { |
25 | +#ifdef ACCEL_COMPILER |
26 | if (!validate_arglist (exp, INTEGER_TYPE, VOID_TYPE)) |
27 | return NULL_RTX; |
28 | |
29 | @@ -5925,13 +5926,8 @@ expand_builtin_acc_on_device (tree exp, rtx target) |
30 | /* Return (arg == v1 || arg == v2) ? 1 : 0. */ |
31 | machine_mode v_mode = TYPE_MODE (TREE_TYPE (arg)); |
32 | rtx v = expand_normal (arg), v1, v2; |
33 | -#ifdef ACCEL_COMPILER |
34 | v1 = GEN_INT (GOMP_DEVICE_NOT_HOST); |
35 | v2 = GEN_INT (ACCEL_COMPILER_acc_device); |
36 | -#else |
37 | - v1 = GEN_INT (GOMP_DEVICE_NONE); |
38 | - v2 = GEN_INT (GOMP_DEVICE_HOST); |
39 | -#endif |
40 | machine_mode target_mode = TYPE_MODE (integer_type_node); |
41 | if (!target || !register_operand (target, target_mode)) |
42 | target = gen_reg_rtx (target_mode); |
43 | @@ -5945,6 +5941,9 @@ expand_builtin_acc_on_device (tree exp, rtx target) |
44 | emit_label (done_label); |
45 | |
46 | return target; |
47 | +#else |
48 | + return NULL; |
49 | +#endif |
50 | } |
51 | |
52 | |
53 | diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c |
54 | index 335ffd4..157147a 100644 |
55 | --- a/libgomp/oacc-init.c |
56 | +++ b/libgomp/oacc-init.c |
57 | @@ -29,6 +29,7 @@ |
58 | #include "libgomp.h" |
59 | #include "oacc-int.h" |
60 | #include "openacc.h" |
61 | +#include "plugin/plugin-host.h" |
62 | #include <assert.h> |
63 | #include <stdlib.h> |
64 | #include <strings.h> |
65 | @@ -611,11 +612,18 @@ ialias (acc_set_device_num) |
66 | int |
67 | acc_on_device (acc_device_t dev) |
68 | { |
69 | - if (acc_get_device_type () == acc_device_host_nonshm) |
70 | + struct goacc_thread *thr = goacc_thread (); |
71 | + |
72 | + /* We only want to appear to be the "host_nonshm" plugin from "offloaded" |
73 | + code -- i.e. within a parallel region. Test a flag set by the |
74 | + openacc_parallel hook of the host_nonshm plugin to determine that. */ |
75 | + if (acc_get_device_type () == acc_device_host_nonshm |
76 | + && thr && thr->target_tls |
77 | + && ((struct nonshm_thread *)thr->target_tls)->nonshm_exec) |
78 | return dev == acc_device_host_nonshm || dev == acc_device_not_host; |
79 | |
80 | - /* Just rely on the compiler builtin. */ |
81 | - return __builtin_acc_on_device (dev); |
82 | + /* For OpenACC, libgomp is only built for the host, so this is sufficient. */ |
83 | + return dev == acc_device_host || dev == acc_device_none; |
84 | } |
85 | |
86 | ialias (acc_on_device) |
87 | diff --git a/libgomp/plugin/plugin-host.c b/libgomp/plugin/plugin-host.c |
88 | index 1faf5bc..3cb4dab 100644 |
89 | --- a/libgomp/plugin/plugin-host.c |
90 | +++ b/libgomp/plugin/plugin-host.c |
91 | @@ -44,6 +44,7 @@ |
92 | #include <stdlib.h> |
93 | #include <string.h> |
94 | #include <stdio.h> |
95 | +#include <stdbool.h> |
96 | |
97 | #ifdef HOST_NONSHM_PLUGIN |
98 | #define STATIC |
99 | @@ -55,6 +56,10 @@ |
100 | #define SELF "host: " |
101 | #endif |
102 | |
103 | +#ifdef HOST_NONSHM_PLUGIN |
104 | +#include "plugin-host.h" |
105 | +#endif |
106 | + |
107 | STATIC const char * |
108 | GOMP_OFFLOAD_get_name (void) |
109 | { |
110 | @@ -174,7 +179,10 @@ GOMP_OFFLOAD_openacc_parallel (void (*fn) (void *), |
111 | void *targ_mem_desc __attribute__ ((unused))) |
112 | { |
113 | #ifdef HOST_NONSHM_PLUGIN |
114 | + struct nonshm_thread *thd = GOMP_PLUGIN_acc_thread (); |
115 | + thd->nonshm_exec = true; |
116 | fn (devaddrs); |
117 | + thd->nonshm_exec = false; |
118 | #else |
119 | fn (hostaddrs); |
120 | #endif |
121 | @@ -232,11 +240,20 @@ STATIC void * |
122 | GOMP_OFFLOAD_openacc_create_thread_data (int ord |
123 | __attribute__ ((unused))) |
124 | { |
125 | +#ifdef HOST_NONSHM_PLUGIN |
126 | + struct nonshm_thread *thd |
127 | + = GOMP_PLUGIN_malloc (sizeof (struct nonshm_thread)); |
128 | + thd->nonshm_exec = false; |
129 | + return thd; |
130 | +#else |
131 | return NULL; |
132 | +#endif |
133 | } |
134 | |
135 | STATIC void |
136 | -GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data |
137 | - __attribute__ ((unused))) |
138 | +GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data) |
139 | { |
140 | +#ifdef HOST_NONSHM_PLUGIN |
141 | + free (tls_data); |
142 | +#endif |
143 | } |
144 | diff --git a/libgomp/plugin/plugin-host.h b/libgomp/plugin/plugin-host.h |
145 | new file mode 100644 |
146 | index 0000000..96955d1 |
147 | --- /dev/null |
148 | +++ b/libgomp/plugin/plugin-host.h |
149 | @@ -0,0 +1,37 @@ |
150 | +/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm. |
151 | + |
152 | + Copyright (C) 2015 Free Software Foundation, Inc. |
153 | + |
154 | + Contributed by Mentor Embedded. |
155 | + |
156 | + This file is part of the GNU Offloading and Multi Processing Library |
157 | + (libgomp). |
158 | + |
159 | + Libgomp is free software; you can redistribute it and/or modify it |
160 | + under the terms of the GNU General Public License as published by |
161 | + the Free Software Foundation; either version 3, or (at your option) |
162 | + any later version. |
163 | + |
164 | + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY |
165 | + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
166 | + FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
167 | + more details. |
168 | + |
169 | + Under Section 7 of GPL version 3, you are granted additional |
170 | + permissions described in the GCC Runtime Library Exception, version |
171 | + 3.1, as published by the Free Software Foundation. |
172 | + |
173 | + You should have received a copy of the GNU General Public License and |
174 | + a copy of the GCC Runtime Library Exception along with this program; |
175 | + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
176 | + <http://www.gnu.org/licenses/>. */ |
177 | + |
178 | +#ifndef PLUGIN_HOST_H |
179 | +#define PLUGIN_HOST_H |
180 | + |
181 | +struct nonshm_thread |
182 | +{ |
183 | + bool nonshm_exec; |
184 | +}; |
185 | + |
186 | +#endif |
187 | diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c |
188 | index 81ea476..25cc15a 100644 |
189 | --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c |
190 | +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c |
191 | @@ -1,7 +1,3 @@ |
192 | -/* Disable the acc_on_device builtin; we want to test the libgomp library |
193 | - function. */ |
194 | -/* { dg-additional-options "-fno-builtin-acc_on_device" } */ |
195 | - |
196 | #include <stdlib.h> |
197 | #include <openacc.h> |
198 | |
199 | diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |
200 | index 184b355..6aa3bb7 100644 |
201 | --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |
202 | +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |
203 | @@ -1,5 +1,4 @@ |
204 | /* { dg-do run } */ |
205 | -/* { dg-additional-options "-fno-builtin-acc_on_device" } */ |
206 | |
207 | #include <openacc.h> |
208 | #include <stdlib.h> |
209 | diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 |
210 | index 4488818..729b685 100644 |
211 | --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 |
212 | +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 |
213 | @@ -1,8 +1,4 @@ |
214 | ! { dg-additional-options "-cpp" } |
215 | -! TODO: Have to disable the acc_on_device builtin for we want to test the |
216 | -! libgomp library function? The command line option |
217 | -! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not for |
218 | -! Fortran. |
219 | |
220 | use openacc |
221 | implicit none |
222 | diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f |
223 | index 0047a19..19ff4a5 100644 |
224 | --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f |
225 | +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f |
226 | @@ -1,8 +1,4 @@ |
227 | ! { dg-additional-options "-cpp" } |
228 | -! TODO: Have to disable the acc_on_device builtin for we want to test |
229 | -! the libgomp library function? The command line option |
230 | -! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not |
231 | -! for Fortran. |
232 | |
233 | USE OPENACC |
234 | IMPLICIT NONE |
235 | diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f |
236 | index 49d7a72..b01c553 100644 |
237 | --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f |
238 | +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f |
239 | @@ -1,8 +1,4 @@ |
240 | ! { dg-additional-options "-cpp" } |
241 | -! TODO: Have to disable the acc_on_device builtin for we want to test |
242 | -! the libgomp library function? The command line option |
243 | -! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not |
244 | -! for Fortran. |
245 | |
246 | IMPLICIT NONE |
247 | INCLUDE "openacc_lib.h" |
248 | |
249 | --- a/gcc/c/c-parser.c 2015-04-20 18:55:33.000000000 +0200 |
250 | +++ b/gcc/c/c-parser.c 2015-05-23 11:32:41.664037866 +0200 |
251 | @@ -13069,12 +13069,9 @@ |
252 | } |
253 | else |
254 | { |
255 | - /* Copy lastprivate (decl) clause to OMP_FOR_CLAUSES, |
256 | - change it to shared (decl) in |
257 | - OMP_PARALLEL_CLAUSES. */ |
258 | - tree l = build_omp_clause (OMP_CLAUSE_LOCATION (*c), |
259 | - OMP_CLAUSE_LASTPRIVATE); |
260 | - OMP_CLAUSE_DECL (l) = OMP_CLAUSE_DECL (*c); |
261 | + /* Move lastprivate (decl) clause to OMP_FOR_CLAUSES. */ |
262 | + tree l = *c; |
263 | + *c = OMP_CLAUSE_CHAIN (*c); |
264 | if (code == OMP_SIMD) |
265 | { |
266 | OMP_CLAUSE_CHAIN (l) |
267 | @@ -13086,7 +13083,6 @@ |
268 | OMP_CLAUSE_CHAIN (l) = clauses; |
269 | clauses = l; |
270 | } |
271 | - OMP_CLAUSE_SET_CODE (*c, OMP_CLAUSE_SHARED); |
272 | } |
273 | } |
274 | } |
275 | @@ -13771,6 +13767,7 @@ |
276 | TREE_TYPE (ret) = void_type_node; |
277 | OMP_TEAMS_CLAUSES (ret) = clauses; |
278 | OMP_TEAMS_BODY (ret) = block; |
279 | + OMP_TEAMS_COMBINED (ret) = 1; |
280 | return add_stmt (ret); |
281 | } |
282 | } |
283 | --- a/gcc/calls.c 2015-04-07 23:02:12.000000000 +0200 |
284 | +++ b/gcc/calls.c 2015-05-23 11:18:33.952634193 +0200 |
285 | @@ -2099,6 +2099,26 @@ |
286 | (XEXP (args[i].value, 0), size))) |
287 | *sibcall_failure = 1; |
288 | |
289 | + if (size % UNITS_PER_WORD == 0 |
290 | + || MEM_ALIGN (mem) % BITS_PER_WORD == 0) |
291 | + move_block_to_reg (REGNO (reg), mem, nregs, args[i].mode); |
292 | + else |
293 | + { |
294 | + if (nregs > 1) |
295 | + move_block_to_reg (REGNO (reg), mem, nregs - 1, |
296 | + args[i].mode); |
297 | + rtx dest = gen_rtx_REG (word_mode, REGNO (reg) + nregs - 1); |
298 | + unsigned int bitoff = (nregs - 1) * BITS_PER_WORD; |
299 | + unsigned int bitsize = size * BITS_PER_UNIT - bitoff; |
300 | + rtx x = extract_bit_field (mem, bitsize, bitoff, 1, |
301 | + dest, word_mode, word_mode); |
302 | + if (BYTES_BIG_ENDIAN) |
303 | + x = expand_shift (LSHIFT_EXPR, word_mode, x, |
304 | + BITS_PER_WORD - bitsize, dest, 1); |
305 | + if (x != dest) |
306 | + emit_move_insn (dest, x); |
307 | + } |
308 | + |
309 | /* Handle a BLKmode that needs shifting. */ |
310 | if (nregs == 1 && size < UNITS_PER_WORD |
311 | #ifdef BLOCK_REG_PADDING |
312 | @@ -2106,22 +2126,18 @@ |
313 | #else |
314 | && BYTES_BIG_ENDIAN |
315 | #endif |
316 | - ) |
317 | + ) |
318 | { |
319 | - rtx tem = operand_subword_force (mem, 0, args[i].mode); |
320 | - rtx ri = gen_rtx_REG (word_mode, REGNO (reg)); |
321 | - rtx x = gen_reg_rtx (word_mode); |
322 | + rtx dest = gen_rtx_REG (word_mode, REGNO (reg)); |
323 | int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT; |
324 | - enum tree_code dir = BYTES_BIG_ENDIAN ? RSHIFT_EXPR |
325 | - : LSHIFT_EXPR; |
326 | + enum tree_code dir = (BYTES_BIG_ENDIAN |
327 | + ? RSHIFT_EXPR : LSHIFT_EXPR); |
328 | + rtx x; |
329 | |
330 | - emit_move_insn (x, tem); |
331 | - x = expand_shift (dir, word_mode, x, shift, ri, 1); |
332 | - if (x != ri) |
333 | - emit_move_insn (ri, x); |
334 | + x = expand_shift (dir, word_mode, dest, shift, dest, 1); |
335 | + if (x != dest) |
336 | + emit_move_insn (dest, x); |
337 | } |
338 | - else |
339 | - move_block_to_reg (REGNO (reg), mem, nregs, args[i].mode); |
340 | } |
341 | |
342 | /* When a parameter is a block, and perhaps in other cases, it is |
343 | --- a/gcc/config/i386/i386.c 2015-04-17 23:55:05.000000000 +0200 |
344 | +++ b/gcc/config/i386/i386.c 2015-05-23 11:27:55.981186322 +0200 |
345 | @@ -2988,6 +2988,17 @@ |
346 | return; |
347 | } |
348 | |
349 | + if ((stringop_alg) i == rep_prefix_8_byte |
350 | + && !TARGET_64BIT) |
351 | + { |
352 | + /* rep; movq isn't available in 32-bit code. */ |
353 | + error ("stringop strategy name %s specified for option %s " |
354 | + "not supported for 32-bit code", |
355 | + alg_name, |
356 | + is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy="); |
357 | + return; |
358 | + } |
359 | + |
360 | input_ranges[n].max = maxs; |
361 | input_ranges[n].alg = (stringop_alg) i; |
362 | if (!strcmp (align, "align")) |
363 | @@ -5867,7 +5878,10 @@ |
364 | /* Return 1 or 2, if we can pass up to SSE_REGPARM_MAX SFmode (1) and |
365 | DFmode (2) arguments in SSE registers for a function with the |
366 | indicated TYPE and DECL. DECL may be NULL when calling function |
367 | - indirectly or considering a libcall. Otherwise return 0. */ |
368 | + indirectly or considering a libcall. Return -1 if any FP parameter |
369 | + should be rejected by error. This is used in siutation we imply SSE |
370 | + calling convetion but the function is called from another function with |
371 | + SSE disabled. Otherwise return 0. */ |
372 | |
373 | static int |
374 | ix86_function_sseregparm (const_tree type, const_tree decl, bool warn) |
375 | @@ -5916,14 +5930,13 @@ |
376 | { |
377 | /* Refuse to produce wrong code when local function with SSE enabled |
378 | is called from SSE disabled function. |
379 | - We may work hard to work out these scenarios but hopefully |
380 | - it doesnot matter in practice. */ |
381 | + FIXME: We need a way to detect these cases cross-ltrans partition |
382 | + and avoid using SSE calling conventions on local functions called |
383 | + from function with SSE disabled. For now at least delay the |
384 | + warning until we know we are going to produce wrong code. |
385 | + See PR66047 */ |
386 | if (!TARGET_SSE && warn) |
387 | - { |
388 | - error ("calling %qD with SSE caling convention without " |
389 | - "SSE/SSE2 enabled", decl); |
390 | - return 0; |
391 | - } |
392 | + return -1; |
393 | return TARGET_SSE2_P (target_opts_for_fn (target->decl) |
394 | ->x_ix86_isa_flags) ? 2 : 1; |
395 | } |
396 | @@ -6479,6 +6492,7 @@ |
397 | cum->bnd_regno = FIRST_BND_REG; |
398 | cum->bnds_in_bt = 0; |
399 | cum->force_bnd_pass = 0; |
400 | + cum->decl = fndecl; |
401 | |
402 | if (!TARGET_64BIT) |
403 | { |
404 | @@ -7424,6 +7438,7 @@ |
405 | HOST_WIDE_INT words) |
406 | { |
407 | int res = 0; |
408 | + bool error_p = NULL; |
409 | |
410 | switch (mode) |
411 | { |
412 | @@ -7456,9 +7471,13 @@ |
413 | gcc_unreachable (); |
414 | |
415 | case DFmode: |
416 | + if (cum->float_in_sse == -1) |
417 | + error_p = 1; |
418 | if (cum->float_in_sse < 2) |
419 | break; |
420 | case SFmode: |
421 | + if (cum->float_in_sse == -1) |
422 | + error_p = 1; |
423 | if (cum->float_in_sse < 1) |
424 | break; |
425 | /* FALLTHRU */ |
426 | @@ -7514,6 +7533,14 @@ |
427 | } |
428 | break; |
429 | } |
430 | + if (error_p) |
431 | + { |
432 | + cum->float_in_sse = 0; |
433 | + error ("calling %qD with SSE calling convention without " |
434 | + "SSE/SSE2 enabled", cum->decl); |
435 | + sorry ("this is a GCC bug that can be worked around by adding " |
436 | + "attribute used to function called"); |
437 | + } |
438 | |
439 | return res; |
440 | } |
441 | @@ -7646,10 +7673,11 @@ |
442 | (otherwise it is an extra parameter matching an ellipsis). */ |
443 | |
444 | static rtx |
445 | -function_arg_32 (const CUMULATIVE_ARGS *cum, machine_mode mode, |
446 | +function_arg_32 (CUMULATIVE_ARGS *cum, machine_mode mode, |
447 | machine_mode orig_mode, const_tree type, |
448 | HOST_WIDE_INT bytes, HOST_WIDE_INT words) |
449 | { |
450 | + bool error_p = false; |
451 | /* Avoid the AL settings for the Unix64 ABI. */ |
452 | if (mode == VOIDmode) |
453 | return constm1_rtx; |
454 | @@ -7690,9 +7718,13 @@ |
455 | break; |
456 | |
457 | case DFmode: |
458 | + if (cum->float_in_sse == -1) |
459 | + error_p = 1; |
460 | if (cum->float_in_sse < 2) |
461 | break; |
462 | case SFmode: |
463 | + if (cum->float_in_sse == -1) |
464 | + error_p = 1; |
465 | if (cum->float_in_sse < 1) |
466 | break; |
467 | /* FALLTHRU */ |
468 | @@ -7751,6 +7783,14 @@ |
469 | } |
470 | break; |
471 | } |
472 | + if (error_p) |
473 | + { |
474 | + cum->float_in_sse = 0; |
475 | + error ("calling %qD with SSE calling convention without " |
476 | + "SSE/SSE2 enabled", cum->decl); |
477 | + sorry ("this is a GCC bug that can be worked around by adding " |
478 | + "attribute used to function called"); |
479 | + } |
480 | |
481 | return NULL_RTX; |
482 | } |
483 | @@ -8230,8 +8270,15 @@ |
484 | if ((fn || fntype) && (mode == SFmode || mode == DFmode)) |
485 | { |
486 | int sse_level = ix86_function_sseregparm (fntype, fn, false); |
487 | - if ((sse_level >= 1 && mode == SFmode) |
488 | - || (sse_level == 2 && mode == DFmode)) |
489 | + if (sse_level == -1) |
490 | + { |
491 | + error ("calling %qD with SSE caling convention without " |
492 | + "SSE/SSE2 enabled", fn); |
493 | + sorry ("this is a GCC bug that can be worked around by adding " |
494 | + "attribute used to function called"); |
495 | + } |
496 | + else if ((sse_level >= 1 && mode == SFmode) |
497 | + || (sse_level == 2 && mode == DFmode)) |
498 | regno = FIRST_SSE_REG; |
499 | } |
500 | |
501 | @@ -46892,15 +46939,16 @@ |
502 | static bool |
503 | expand_vec_perm_blend (struct expand_vec_perm_d *d) |
504 | { |
505 | - machine_mode vmode = d->vmode; |
506 | + machine_mode mmode, vmode = d->vmode; |
507 | unsigned i, mask, nelt = d->nelt; |
508 | - rtx target, op0, op1, x; |
509 | + rtx target, op0, op1, maskop, x; |
510 | rtx rperm[32], vperm; |
511 | |
512 | if (d->one_operand_p) |
513 | return false; |
514 | if (TARGET_AVX512F && GET_MODE_SIZE (vmode) == 64 |
515 | - && GET_MODE_SIZE (GET_MODE_INNER (vmode)) >= 4) |
516 | + && (TARGET_AVX512BW |
517 | + || GET_MODE_SIZE (GET_MODE_INNER (vmode)) >= 4)) |
518 | ; |
519 | else if (TARGET_AVX2 && GET_MODE_SIZE (vmode) == 32) |
520 | ; |
521 | @@ -47074,8 +47122,33 @@ |
522 | gcc_unreachable (); |
523 | } |
524 | |
525 | + switch (vmode) |
526 | + { |
527 | + case V8DFmode: |
528 | + case V8DImode: |
529 | + mmode = QImode; |
530 | + break; |
531 | + case V16SFmode: |
532 | + case V16SImode: |
533 | + mmode = HImode; |
534 | + break; |
535 | + case V32HImode: |
536 | + mmode = SImode; |
537 | + break; |
538 | + case V64QImode: |
539 | + mmode = DImode; |
540 | + break; |
541 | + default: |
542 | + mmode = VOIDmode; |
543 | + } |
544 | + |
545 | + if (mmode != VOIDmode) |
546 | + maskop = force_reg (mmode, gen_int_mode (mask, mmode)); |
547 | + else |
548 | + maskop = GEN_INT (mask); |
549 | + |
550 | /* This matches five different patterns with the different modes. */ |
551 | - x = gen_rtx_VEC_MERGE (vmode, op1, op0, GEN_INT (mask)); |
552 | + x = gen_rtx_VEC_MERGE (vmode, op1, op0, maskop); |
553 | x = gen_rtx_SET (VOIDmode, target, x); |
554 | emit_insn (x); |
555 | if (target != d->target) |
556 | @@ -51606,7 +51679,7 @@ |
557 | for (i = 0; i < loop->num_nodes; i++) |
558 | FOR_BB_INSNS (bbs[i], insn) |
559 | if (NONDEBUG_INSN_P (insn)) |
560 | - FOR_EACH_SUBRTX (iter, array, insn, NONCONST) |
561 | + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST) |
562 | if (const_rtx x = *iter) |
563 | if (MEM_P (x)) |
564 | { |
565 | --- a/gcc/config/i386/i386.h 2015-02-21 01:06:53.000000000 +0100 |
566 | +++ b/gcc/config/i386/i386.h 2015-05-23 11:26:56.002281385 +0200 |
567 | @@ -1682,6 +1682,7 @@ |
568 | int stdarg; /* Set to 1 if function is stdarg. */ |
569 | enum calling_abi call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise |
570 | MS_ABI for ms abi. */ |
571 | + tree decl; /* Callee decl. */ |
572 | } CUMULATIVE_ARGS; |
573 | |
574 | /* Initialize a variable CUM of type CUMULATIVE_ARGS |
575 | --- a/gcc/config/i386/sse.md 2015-04-09 23:37:28.000000000 +0200 |
576 | +++ b/gcc/config/i386/sse.md 2015-05-23 11:18:33.954634308 +0200 |
577 | @@ -9523,7 +9523,7 @@ |
578 | (mult:V4DI |
579 | (sign_extend:V4DI |
580 | (vec_select:V4SI |
581 | - (match_operand:V8SI 1 "nonimmediate_operand" "v") |
582 | + (match_operand:V8SI 1 "nonimmediate_operand" "%v") |
583 | (parallel [(const_int 0) (const_int 2) |
584 | (const_int 4) (const_int 6)]))) |
585 | (sign_extend:V4DI |
586 | --- a/gcc/cp/constexpr.c 2015-04-12 21:10:58.000000000 +0200 |
587 | +++ b/gcc/cp/constexpr.c 2015-05-23 11:18:33.955634365 +0200 |
588 | @@ -1355,7 +1355,14 @@ |
589 | fun = DECL_CHAIN (fun)) |
590 | if (DECL_SAVED_TREE (fun)) |
591 | break; |
592 | - gcc_assert (DECL_SAVED_TREE (fun)); |
593 | + if (!DECL_SAVED_TREE (fun)) |
594 | + { |
595 | + /* cgraph/gimplification have released the DECL_SAVED_TREE |
596 | + for this function. Fail gracefully. */ |
597 | + gcc_assert (ctx->quiet); |
598 | + *non_constant_p = true; |
599 | + return t; |
600 | + } |
601 | tree parms, res; |
602 | |
603 | /* Unshare the whole function body. */ |
604 | @@ -2603,14 +2610,29 @@ |
605 | { |
606 | constexpr_ctx new_ctx = *ctx; |
607 | |
608 | + tree init = TREE_OPERAND (t, 1); |
609 | + |
610 | /* First we figure out where we're storing to. */ |
611 | tree target = TREE_OPERAND (t, 0); |
612 | + tree type = TREE_TYPE (target); |
613 | target = cxx_eval_constant_expression (ctx, target, |
614 | true, |
615 | non_constant_p, overflow_p); |
616 | if (*non_constant_p) |
617 | return t; |
618 | |
619 | + if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (target), type) |
620 | + && is_empty_class (type)) |
621 | + { |
622 | + /* For initialization of an empty base, the original target will be |
623 | + *(base*)this, which the above evaluation resolves to the object |
624 | + argument, which has the derived type rather than the base type. In |
625 | + this situation, just evaluate the initializer and return, since |
626 | + there's no actual data to store. */ |
627 | + return cxx_eval_constant_expression (ctx, init, false, |
628 | + non_constant_p, overflow_p); |
629 | + } |
630 | + |
631 | /* And then find the underlying variable. */ |
632 | vec<tree,va_gc> *refs = make_tree_vector(); |
633 | tree object = NULL_TREE; |
634 | @@ -2647,7 +2669,7 @@ |
635 | *non_constant_p = true; |
636 | return t; |
637 | } |
638 | - tree type = TREE_TYPE (object); |
639 | + type = TREE_TYPE (object); |
640 | while (!refs->is_empty()) |
641 | { |
642 | if (*valp == NULL_TREE) |
643 | @@ -2684,9 +2706,8 @@ |
644 | new_ctx.object = target; |
645 | } |
646 | |
647 | - tree init = cxx_eval_constant_expression (&new_ctx, TREE_OPERAND (t, 1), |
648 | - false, |
649 | - non_constant_p, overflow_p); |
650 | + init = cxx_eval_constant_expression (&new_ctx, init, false, |
651 | + non_constant_p, overflow_p); |
652 | if (target == object) |
653 | /* The hash table might have moved since the get earlier. */ |
654 | ctx->values->put (object, init); |
655 | --- a/gcc/cp/cvt.c 2015-01-09 21:18:42.000000000 +0100 |
656 | +++ b/gcc/cp/cvt.c 2015-05-23 11:18:33.956634423 +0200 |
657 | @@ -603,8 +603,20 @@ |
658 | tree |
659 | cp_fold_convert (tree type, tree expr) |
660 | { |
661 | - tree conv = fold_convert (type, expr); |
662 | - conv = ignore_overflows (conv, expr); |
663 | + tree conv; |
664 | + if (TREE_TYPE (expr) == type) |
665 | + conv = expr; |
666 | + else if (TREE_CODE (expr) == PTRMEM_CST) |
667 | + { |
668 | + /* Avoid wrapping a PTRMEM_CST in NOP_EXPR. */ |
669 | + conv = copy_node (expr); |
670 | + TREE_TYPE (conv) = type; |
671 | + } |
672 | + else |
673 | + { |
674 | + conv = fold_convert (type, expr); |
675 | + conv = ignore_overflows (conv, expr); |
676 | + } |
677 | return conv; |
678 | } |
679 | |
680 | --- a/gcc/cp/decl2.c 2015-03-19 20:12:43.000000000 +0100 |
681 | +++ b/gcc/cp/decl2.c 2015-05-23 11:24:52.397411028 +0200 |
682 | @@ -1175,6 +1175,10 @@ |
683 | && is_attribute_p ("omp declare simd", name)) |
684 | return true; |
685 | |
686 | + /* An attribute pack is clearly dependent. */ |
687 | + if (args && PACK_EXPANSION_P (args)) |
688 | + return true; |
689 | + |
690 | /* If any of the arguments are dependent expressions, we can't evaluate |
691 | the attribute until instantiation time. */ |
692 | for (arg = args; arg; arg = TREE_CHAIN (arg)) |
693 | --- a/gcc/cp/decl.c 2015-04-02 18:43:02.000000000 +0200 |
694 | +++ b/gcc/cp/decl.c 2015-05-23 11:23:34.737303073 +0200 |
695 | @@ -4825,8 +4825,11 @@ |
696 | |
697 | was_public = TREE_PUBLIC (decl); |
698 | |
699 | - /* Enter this declaration into the symbol table. */ |
700 | - decl = maybe_push_decl (decl); |
701 | + /* Enter this declaration into the symbol table. Don't push the plain |
702 | + VAR_DECL for a variable template. */ |
703 | + if (!template_parm_scope_p () |
704 | + || TREE_CODE (decl) != VAR_DECL) |
705 | + decl = maybe_push_decl (decl); |
706 | |
707 | if (processing_template_decl) |
708 | decl = push_template_decl (decl); |
709 | @@ -10628,7 +10631,7 @@ |
710 | } |
711 | else if (decl_context == FIELD) |
712 | { |
713 | - if (!staticp && TREE_CODE (type) != METHOD_TYPE |
714 | + if (!staticp && !friendp && TREE_CODE (type) != METHOD_TYPE |
715 | && type_uses_auto (type)) |
716 | { |
717 | error ("non-static data member declared %<auto%>"); |
718 | --- a/gcc/cp/lambda.c 2015-04-03 19:23:27.000000000 +0200 |
719 | +++ b/gcc/cp/lambda.c 2015-05-23 11:18:33.958634538 +0200 |
720 | @@ -787,7 +787,7 @@ |
721 | /* In a lambda, need to go through 'this' capture. */ |
722 | tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); |
723 | tree cap = lambda_expr_this_capture (lam, add_capture_p); |
724 | - if (cap != error_mark_node) |
725 | + if (cap && cap != error_mark_node) |
726 | object = build_x_indirect_ref (EXPR_LOCATION (object), cap, |
727 | RO_NULL, tf_warning_or_error); |
728 | } |
729 | --- a/gcc/cp/name-lookup.c 2015-04-01 23:27:55.000000000 +0200 |
730 | +++ b/gcc/cp/name-lookup.c 2015-05-23 11:18:33.958634538 +0200 |
731 | @@ -3408,7 +3408,7 @@ |
732 | tf_warning_or_error); |
733 | if (b_kind < bk_proper_base) |
734 | { |
735 | - if (!bases_dependent_p) |
736 | + if (!bases_dependent_p || b_kind == bk_same_type) |
737 | { |
738 | error_not_base_type (scope, current_class_type); |
739 | return NULL_TREE; |
740 | --- a/gcc/cp/parser.c 2015-04-20 18:55:33.000000000 +0200 |
741 | +++ b/gcc/cp/parser.c 2015-05-23 11:32:41.668037917 +0200 |
742 | @@ -22500,6 +22500,13 @@ |
743 | attributes = attribute; |
744 | } |
745 | token = cp_lexer_peek_token (parser->lexer); |
746 | + if (token->type == CPP_ELLIPSIS) |
747 | + { |
748 | + cp_lexer_consume_token (parser->lexer); |
749 | + TREE_VALUE (attribute) |
750 | + = make_pack_expansion (TREE_VALUE (attribute)); |
751 | + token = cp_lexer_peek_token (parser->lexer); |
752 | + } |
753 | if (token->type != CPP_COMMA) |
754 | break; |
755 | cp_lexer_consume_token (parser->lexer); |
756 | @@ -22578,20 +22585,27 @@ |
757 | return alignas_expr; |
758 | } |
759 | |
760 | + alignas_expr = cxx_alignas_expr (alignas_expr); |
761 | + alignas_expr = build_tree_list (NULL_TREE, alignas_expr); |
762 | + |
763 | + if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) |
764 | + { |
765 | + cp_lexer_consume_token (parser->lexer); |
766 | + alignas_expr = make_pack_expansion (alignas_expr); |
767 | + } |
768 | + |
769 | if (cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN) == NULL) |
770 | { |
771 | cp_parser_error (parser, "expected %<)%>"); |
772 | return error_mark_node; |
773 | } |
774 | |
775 | - alignas_expr = cxx_alignas_expr (alignas_expr); |
776 | - |
777 | /* Build the C++-11 representation of an 'aligned' |
778 | attribute. */ |
779 | attributes = |
780 | build_tree_list (build_tree_list (get_identifier ("gnu"), |
781 | get_identifier ("aligned")), |
782 | - build_tree_list (NULL_TREE, alignas_expr)); |
783 | + alignas_expr); |
784 | } |
785 | |
786 | return attributes; |
787 | @@ -30466,11 +30480,9 @@ |
788 | else if (OMP_CLAUSE_CODE (*c) == OMP_CLAUSE_LASTPRIVATE |
789 | && OMP_CLAUSE_DECL (*c) == real_decl) |
790 | { |
791 | - /* Add lastprivate (decl) clause to OMP_FOR_CLAUSES, |
792 | - change it to shared (decl) in OMP_PARALLEL_CLAUSES. */ |
793 | - tree l = build_omp_clause (loc, OMP_CLAUSE_LASTPRIVATE); |
794 | - OMP_CLAUSE_DECL (l) = real_decl; |
795 | - CP_OMP_CLAUSE_INFO (l) = CP_OMP_CLAUSE_INFO (*c); |
796 | + /* Move lastprivate (decl) clause to OMP_FOR_CLAUSES. */ |
797 | + tree l = *c; |
798 | + *c = OMP_CLAUSE_CHAIN (*c); |
799 | if (code == OMP_SIMD) |
800 | { |
801 | OMP_CLAUSE_CHAIN (l) = cclauses[C_OMP_CLAUSE_SPLIT_FOR]; |
802 | @@ -30481,8 +30493,6 @@ |
803 | OMP_CLAUSE_CHAIN (l) = clauses; |
804 | clauses = l; |
805 | } |
806 | - OMP_CLAUSE_SET_CODE (*c, OMP_CLAUSE_SHARED); |
807 | - CP_OMP_CLAUSE_INFO (*c) = NULL; |
808 | add_private_clause = false; |
809 | } |
810 | else |
811 | @@ -31316,6 +31326,7 @@ |
812 | TREE_TYPE (ret) = void_type_node; |
813 | OMP_TEAMS_CLAUSES (ret) = clauses; |
814 | OMP_TEAMS_BODY (ret) = body; |
815 | + OMP_TEAMS_COMBINED (ret) = 1; |
816 | return add_stmt (ret); |
817 | } |
818 | } |
819 | --- a/gcc/cp/pt.c 2015-04-01 23:27:55.000000000 +0200 |
820 | +++ b/gcc/cp/pt.c 2015-05-23 11:27:30.146802454 +0200 |
821 | @@ -1919,7 +1919,13 @@ |
822 | ++header_count; |
823 | |
824 | if (variable_template_p (fns)) |
825 | - templates = tree_cons (explicit_targs, fns, templates); |
826 | + { |
827 | + tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (fns)); |
828 | + targs = coerce_template_parms (parms, explicit_targs, fns, |
829 | + tf_warning_or_error, |
830 | + /*req_all*/true, /*use_defarg*/true); |
831 | + templates = tree_cons (targs, fns, templates); |
832 | + } |
833 | else for (; fns; fns = OVL_NEXT (fns)) |
834 | { |
835 | tree fn = OVL_CURRENT (fns); |
836 | @@ -3338,9 +3344,9 @@ |
837 | if (!arg || arg == error_mark_node) |
838 | return arg; |
839 | |
840 | - if (TREE_CODE (arg) == TREE_LIST) |
841 | + if (TREE_CODE (arg) == TREE_LIST && TREE_PURPOSE (arg)) |
842 | { |
843 | - /* The only time we will see a TREE_LIST here is for a base |
844 | + /* A TREE_LIST with a non-null TREE_PURPOSE is for a base |
845 | class initializer. In this case, the TREE_PURPOSE will be a |
846 | _TYPE node (representing the base class expansion we're |
847 | initializing) and the TREE_VALUE will be a TREE_LIST |
848 | @@ -9065,6 +9071,21 @@ |
849 | = tree_cons (NULL_TREE, TREE_VALUE (TREE_VALUE (t)), |
850 | chain); |
851 | } |
852 | + else if (TREE_VALUE (t) && PACK_EXPANSION_P (TREE_VALUE (t))) |
853 | + { |
854 | + /* An attribute pack expansion. */ |
855 | + tree purp = TREE_PURPOSE (t); |
856 | + tree pack = (tsubst_pack_expansion |
857 | + (TREE_VALUE (t), args, complain, in_decl)); |
858 | + int len = TREE_VEC_LENGTH (pack); |
859 | + for (int i = 0; i < len; ++i) |
860 | + { |
861 | + tree elt = TREE_VEC_ELT (pack, i); |
862 | + *q = build_tree_list (purp, elt); |
863 | + q = &TREE_CHAIN (*q); |
864 | + } |
865 | + continue; |
866 | + } |
867 | else |
868 | TREE_VALUE (t) |
869 | = tsubst_expr (TREE_VALUE (t), args, complain, in_decl, |
870 | @@ -11302,6 +11323,11 @@ |
871 | tmpl = DECL_TI_TEMPLATE (t); |
872 | gen_tmpl = most_general_template (tmpl); |
873 | argvec = tsubst (DECL_TI_ARGS (t), args, complain, in_decl); |
874 | + if (argvec != error_mark_node) |
875 | + argvec = (coerce_innermost_template_parms |
876 | + (DECL_TEMPLATE_PARMS (gen_tmpl), |
877 | + argvec, t, complain, |
878 | + /*all*/true, /*defarg*/true)); |
879 | if (argvec == error_mark_node) |
880 | RETURN (error_mark_node); |
881 | hash = hash_tmpl_and_args (gen_tmpl, argvec); |
882 | @@ -14249,7 +14275,7 @@ |
883 | tmp = tsubst_omp_clauses (OMP_TARGET_UPDATE_CLAUSES (t), false, |
884 | args, complain, in_decl); |
885 | t = copy_node (t); |
886 | - OMP_CLAUSES (t) = tmp; |
887 | + OMP_TARGET_UPDATE_CLAUSES (t) = tmp; |
888 | add_stmt (t); |
889 | break; |
890 | |
891 | --- a/gcc/cp/tree.c 2015-04-09 22:11:44.000000000 +0200 |
892 | +++ b/gcc/cp/tree.c 2015-05-23 11:27:15.316578155 +0200 |
893 | @@ -1207,6 +1207,7 @@ |
894 | { |
895 | bool changed = false; |
896 | vec<tree,va_gc> *vec = make_tree_vector (); |
897 | + tree r = t; |
898 | for (; t; t = TREE_CHAIN (t)) |
899 | { |
900 | gcc_assert (!TREE_PURPOSE (t)); |
901 | @@ -1215,7 +1216,6 @@ |
902 | changed = true; |
903 | vec_safe_push (vec, elt); |
904 | } |
905 | - tree r = t; |
906 | if (changed) |
907 | r = build_tree_list_vec (vec); |
908 | release_tree_vector (vec); |
909 | @@ -1350,7 +1350,7 @@ |
910 | case DECLTYPE_TYPE: |
911 | result = strip_typedefs_expr (DECLTYPE_TYPE_EXPR (t)); |
912 | if (result == DECLTYPE_TYPE_EXPR (t)) |
913 | - return t; |
914 | + result = NULL_TREE; |
915 | else |
916 | result = (finish_decltype_type |
917 | (result, |
918 | @@ -1424,8 +1424,8 @@ |
919 | && type2 == TRAIT_EXPR_TYPE2 (t)) |
920 | return t; |
921 | r = copy_node (t); |
922 | - TRAIT_EXPR_TYPE1 (t) = type1; |
923 | - TRAIT_EXPR_TYPE2 (t) = type2; |
924 | + TRAIT_EXPR_TYPE1 (r) = type1; |
925 | + TRAIT_EXPR_TYPE2 (r) = type2; |
926 | return r; |
927 | } |
928 | |
929 | --- a/gcc/cp/typeck2.c 2015-01-23 17:30:00.000000000 +0100 |
930 | +++ b/gcc/cp/typeck2.c 2015-05-23 11:24:32.144136275 +0200 |
931 | @@ -957,9 +957,16 @@ |
932 | } |
933 | } |
934 | else if (complain & tf_error) |
935 | - error_at (EXPR_LOC_OR_LOC (init, input_location), |
936 | - "narrowing conversion of %qE from %qT to %qT inside { }", |
937 | - init, ftype, type); |
938 | + { |
939 | + int savederrorcount = errorcount; |
940 | + global_dc->pedantic_errors = 1; |
941 | + pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, |
942 | + "narrowing conversion of %qE from %qT to %qT " |
943 | + "inside { }", init, ftype, type); |
944 | + if (errorcount == savederrorcount) |
945 | + ok = true; |
946 | + global_dc->pedantic_errors = flag_pedantic_errors; |
947 | + } |
948 | } |
949 | |
950 | return cxx_dialect == cxx98 || ok; |
951 | @@ -1089,6 +1096,19 @@ |
952 | || TREE_CODE (type) == UNION_TYPE |
953 | || TREE_CODE (type) == COMPLEX_TYPE); |
954 | |
955 | + /* "If T is a class type and the initializer list has a single |
956 | + element of type cv U, where U is T or a class derived from T, |
957 | + the object is initialized from that element." */ |
958 | + if (cxx_dialect >= cxx11 |
959 | + && BRACE_ENCLOSED_INITIALIZER_P (init) |
960 | + && CONSTRUCTOR_NELTS (init) == 1 |
961 | + && (CLASS_TYPE_P (type) || VECTOR_TYPE_P (type))) |
962 | + { |
963 | + tree elt = CONSTRUCTOR_ELT (init, 0)->value; |
964 | + if (reference_related_p (type, TREE_TYPE (elt))) |
965 | + init = elt; |
966 | + } |
967 | + |
968 | if (BRACE_ENCLOSED_INITIALIZER_P (init) |
969 | && !TYPE_NON_AGGREGATE_CLASS (type)) |
970 | return process_init_constructor (type, init, complain); |
971 | --- a/gcc/fortran/check.c 2015-03-02 19:56:51.000000000 +0100 |
972 | +++ b/gcc/fortran/check.c 2015-05-23 11:29:30.690530828 +0200 |
973 | @@ -6213,6 +6213,15 @@ |
974 | bool |
975 | gfc_check_storage_size (gfc_expr *a, gfc_expr *kind) |
976 | { |
977 | + |
978 | + if (a->expr_type == EXPR_NULL) |
979 | + { |
980 | + gfc_error ("Intrinsic function NULL at %L cannot be an actual " |
981 | + "argument to STORAGE_SIZE, because it returns a " |
982 | + "disassociated pointer", &a->where); |
983 | + return false; |
984 | + } |
985 | + |
986 | if (a->ts.type == BT_ASSUMED) |
987 | { |
988 | gfc_error ("%qs argument of %qs intrinsic at %L shall not be TYPE(*)", |
989 | --- a/gcc/fortran/decl.c 2015-04-10 13:29:53.000000000 +0200 |
990 | +++ b/gcc/fortran/decl.c 2015-05-23 11:30:42.240495466 +0200 |
991 | @@ -1404,9 +1404,7 @@ |
992 | } |
993 | else if (init->expr_type == EXPR_ARRAY) |
994 | { |
995 | - gfc_constructor *c; |
996 | - c = gfc_constructor_first (init->value.constructor); |
997 | - clen = c->expr->value.character.length; |
998 | + clen = mpz_get_si (init->ts.u.cl->length->value.integer); |
999 | sym->ts.u.cl->length |
1000 | = gfc_get_int_expr (gfc_default_integer_kind, |
1001 | NULL, clen); |
1002 | @@ -5594,7 +5592,7 @@ |
1003 | "a contained subprogram"); |
1004 | break; |
1005 | default: |
1006 | - gfc_internal_error ("gfc_match_entry(): Bad state"); |
1007 | + gfc_error ("Unexpected ENTRY statement at %C"); |
1008 | } |
1009 | return MATCH_ERROR; |
1010 | } |
1011 | @@ -6970,7 +6968,8 @@ |
1012 | gfc_symbol *sym; |
1013 | match m; |
1014 | |
1015 | - if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE) |
1016 | + if (!gfc_current_ns->proc_name |
1017 | + || gfc_current_ns->proc_name->attr.flavor != FL_MODULE) |
1018 | { |
1019 | gfc_error ("PROTECTED at %C only allowed in specification " |
1020 | "part of a module"); |
1021 | @@ -8512,6 +8511,11 @@ |
1022 | gfc_op2string (op)); |
1023 | break; |
1024 | |
1025 | + case INTERFACE_NAMELESS: |
1026 | + gfc_error ("Malformed GENERIC statement at %C"); |
1027 | + goto error; |
1028 | + break; |
1029 | + |
1030 | default: |
1031 | gcc_unreachable (); |
1032 | } |
1033 | --- a/gcc/fortran/expr.c 2015-02-06 19:15:01.000000000 +0100 |
1034 | +++ b/gcc/fortran/expr.c 2015-05-23 11:30:07.135026771 +0200 |
1035 | @@ -3118,19 +3118,22 @@ |
1036 | bad_proc = true; |
1037 | |
1038 | /* (ii) The assignment is in the main program; or */ |
1039 | - if (gfc_current_ns->proc_name->attr.is_main_program) |
1040 | + if (gfc_current_ns->proc_name |
1041 | + && gfc_current_ns->proc_name->attr.is_main_program) |
1042 | bad_proc = true; |
1043 | |
1044 | /* (iii) A module or internal procedure... */ |
1045 | - if ((gfc_current_ns->proc_name->attr.proc == PROC_INTERNAL |
1046 | - || gfc_current_ns->proc_name->attr.proc == PROC_MODULE) |
1047 | + if (gfc_current_ns->proc_name |
1048 | + && (gfc_current_ns->proc_name->attr.proc == PROC_INTERNAL |
1049 | + || gfc_current_ns->proc_name->attr.proc == PROC_MODULE) |
1050 | && gfc_current_ns->parent |
1051 | && (!(gfc_current_ns->parent->proc_name->attr.function |
1052 | || gfc_current_ns->parent->proc_name->attr.subroutine) |
1053 | || gfc_current_ns->parent->proc_name->attr.is_main_program)) |
1054 | { |
1055 | /* ... that is not a function... */ |
1056 | - if (!gfc_current_ns->proc_name->attr.function) |
1057 | + if (gfc_current_ns->proc_name |
1058 | + && !gfc_current_ns->proc_name->attr.function) |
1059 | bad_proc = true; |
1060 | |
1061 | /* ... or is not an entry and has a different name. */ |
1062 | --- a/gcc/fortran/interface.c 2015-02-01 01:29:54.000000000 +0100 |
1063 | +++ b/gcc/fortran/interface.c 2015-05-23 11:30:58.232706361 +0200 |
1064 | @@ -346,8 +346,12 @@ |
1065 | break; |
1066 | |
1067 | m = MATCH_ERROR; |
1068 | - gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> at %C, " |
1069 | - "but got %s", s1, s2); |
1070 | + if (strcmp(s2, "none") == 0) |
1071 | + gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> " |
1072 | + "at %C, ", s1); |
1073 | + else |
1074 | + gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> at %C, " |
1075 | + "but got %s", s1, s2); |
1076 | } |
1077 | |
1078 | } |
1079 | --- a/gcc/fortran/io.c 2015-02-01 01:29:54.000000000 +0100 |
1080 | +++ b/gcc/fortran/io.c 2015-05-23 11:31:18.785975216 +0200 |
1081 | @@ -385,7 +385,7 @@ |
1082 | |
1083 | if (c == delim) |
1084 | { |
1085 | - c = next_char (INSTRING_NOWARN); |
1086 | + c = next_char (NONSTRING); |
1087 | |
1088 | if (c == '\0') |
1089 | { |
1090 | @@ -2382,9 +2382,7 @@ |
1091 | if (m == MATCH_NO) |
1092 | { |
1093 | m = gfc_match_expr (&fp->unit); |
1094 | - if (m == MATCH_ERROR) |
1095 | - goto done; |
1096 | - if (m == MATCH_NO) |
1097 | + if (m == MATCH_ERROR || m == MATCH_NO) |
1098 | goto syntax; |
1099 | } |
1100 | |
1101 | --- a/gcc/fortran/match.c 2015-01-15 21:11:12.000000000 +0100 |
1102 | +++ b/gcc/fortran/match.c 2015-05-23 11:30:58.232706361 +0200 |
1103 | @@ -110,6 +110,9 @@ |
1104 | case INTRINSIC_PARENTHESES: |
1105 | return "parens"; |
1106 | |
1107 | + case INTRINSIC_NONE: |
1108 | + return "none"; |
1109 | + |
1110 | default: |
1111 | break; |
1112 | } |
1113 | --- a/gcc/fortran/parse.c 2015-02-01 01:29:54.000000000 +0100 |
1114 | +++ b/gcc/fortran/parse.c 2015-05-23 11:29:15.011314175 +0200 |
1115 | @@ -2425,8 +2425,7 @@ |
1116 | break; |
1117 | |
1118 | default: |
1119 | - gfc_internal_error ("Unexpected %s statement in verify_st_order() at %C", |
1120 | - gfc_ascii_statement (st)); |
1121 | + return false; |
1122 | } |
1123 | |
1124 | /* All is well, record the statement in case we need it next time. */ |
1125 | --- a/gcc/fortran/scanner.c 2015-02-13 17:57:28.000000000 +0100 |
1126 | +++ b/gcc/fortran/scanner.c 2015-05-23 11:31:18.785975216 +0200 |
1127 | @@ -1272,21 +1272,11 @@ |
1128 | are still in a string and we are looking for a possible |
1129 | doubled quote and we end up here. See PR64506. */ |
1130 | |
1131 | - if (in_string) |
1132 | + if (in_string && c != '\n') |
1133 | { |
1134 | gfc_current_locus = old_loc; |
1135 | - |
1136 | - if (c == '!') |
1137 | - { |
1138 | - skip_comment_line (); |
1139 | - goto restart; |
1140 | - } |
1141 | - |
1142 | - if (c != '\n') |
1143 | - { |
1144 | - c = '&'; |
1145 | - goto done; |
1146 | - } |
1147 | + c = '&'; |
1148 | + goto done; |
1149 | } |
1150 | |
1151 | if (c != '!' && c != '\n') |
1152 | @@ -1392,6 +1382,8 @@ |
1153 | "Missing %<&%> in continued character " |
1154 | "constant at %C"); |
1155 | } |
1156 | + else if (!in_string && (c == '\'' || c == '"')) |
1157 | + goto done; |
1158 | /* Both !$omp and !$ -fopenmp continuation lines have & on the |
1159 | continuation line only optionally. */ |
1160 | else if (openmp_flag || openacc_flag || openmp_cond_flag) |
1161 | --- a/gcc/fortran/symbol.c 2015-04-10 13:29:53.000000000 +0200 |
1162 | +++ b/gcc/fortran/symbol.c 2015-05-23 11:28:41.895849323 +0200 |
1163 | @@ -458,6 +458,11 @@ |
1164 | } |
1165 | } |
1166 | |
1167 | + if (attr->dummy && ((attr->function || attr->subroutine) && |
1168 | + gfc_current_state () == COMP_CONTAINS)) |
1169 | + gfc_error_now ("internal procedure '%s' at %L conflicts with " |
1170 | + "DUMMY argument", name, where); |
1171 | + |
1172 | conf (dummy, entry); |
1173 | conf (dummy, intrinsic); |
1174 | conf (dummy, threadprivate); |
1175 | --- a/gcc/fortran/trans-openmp.c 2015-03-30 19:54:05.000000000 +0200 |
1176 | +++ b/gcc/fortran/trans-openmp.c 2015-05-23 11:32:41.669037929 +0200 |
1177 | @@ -4114,6 +4114,7 @@ |
1178 | stmtblock_t block; |
1179 | gfc_omp_clauses clausesa_buf[GFC_OMP_SPLIT_NUM]; |
1180 | tree stmt, omp_clauses = NULL_TREE; |
1181 | + bool combined = true; |
1182 | |
1183 | gfc_start_block (&block); |
1184 | if (clausesa == NULL) |
1185 | @@ -4130,6 +4131,7 @@ |
1186 | case EXEC_OMP_TARGET_TEAMS: |
1187 | case EXEC_OMP_TEAMS: |
1188 | stmt = gfc_trans_omp_code (code->block->next, true); |
1189 | + combined = false; |
1190 | break; |
1191 | case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE: |
1192 | case EXEC_OMP_TEAMS_DISTRIBUTE: |
1193 | @@ -4143,6 +4145,8 @@ |
1194 | } |
1195 | stmt = build2_loc (input_location, OMP_TEAMS, void_type_node, stmt, |
1196 | omp_clauses); |
1197 | + if (combined) |
1198 | + OMP_TEAMS_COMBINED (stmt) = 1; |
1199 | gfc_add_expr_to_block (&block, stmt); |
1200 | return gfc_finish_block (&block); |
1201 | } |
1202 | @@ -4163,9 +4167,14 @@ |
1203 | if (code->op == EXEC_OMP_TARGET) |
1204 | stmt = gfc_trans_omp_code (code->block->next, true); |
1205 | else |
1206 | - stmt = gfc_trans_omp_teams (code, clausesa); |
1207 | - if (TREE_CODE (stmt) != BIND_EXPR) |
1208 | - stmt = build3_v (BIND_EXPR, NULL, stmt, NULL_TREE); |
1209 | + { |
1210 | + pushlevel (); |
1211 | + stmt = gfc_trans_omp_teams (code, clausesa); |
1212 | + if (TREE_CODE (stmt) != BIND_EXPR) |
1213 | + stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0)); |
1214 | + else |
1215 | + poplevel (0, 0); |
1216 | + } |
1217 | if (flag_openmp) |
1218 | stmt = build2_loc (input_location, OMP_TARGET, void_type_node, stmt, |
1219 | omp_clauses); |
1220 | --- a/gcc/gimplify.c 2015-03-20 13:39:32.000000000 +0100 |
1221 | +++ b/gcc/gimplify.c 2015-05-23 11:32:41.671037954 +0200 |
1222 | @@ -111,6 +111,9 @@ |
1223 | /* Flag for GOVD_MAP: don't copy back. */ |
1224 | GOVD_MAP_TO_ONLY = 8192, |
1225 | |
1226 | + /* Flag for GOVD_LINEAR or GOVD_LASTPRIVATE: no outer reference. */ |
1227 | + GOVD_LINEAR_LASTPRIVATE_NO_OUTER = 16384, |
1228 | + |
1229 | GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE |
1230 | | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LINEAR |
1231 | | GOVD_LOCAL) |
1232 | @@ -126,6 +129,7 @@ |
1233 | ORT_TASK = 4, |
1234 | ORT_UNTIED_TASK = 5, |
1235 | ORT_TEAMS = 8, |
1236 | + ORT_COMBINED_TEAMS = 9, |
1237 | /* Data region. */ |
1238 | ORT_TARGET_DATA = 16, |
1239 | /* Data region with offloading. */ |
1240 | @@ -5842,7 +5846,7 @@ |
1241 | DECL_NAME (lang_hooks.decls.omp_report_decl (decl))); |
1242 | error_at (ctx->location, "enclosing task"); |
1243 | } |
1244 | - else if (ctx->region_type == ORT_TEAMS) |
1245 | + else if (ctx->region_type & ORT_TEAMS) |
1246 | { |
1247 | error ("%qE not specified in enclosing teams construct", |
1248 | DECL_NAME (lang_hooks.decls.omp_report_decl (decl))); |
1249 | @@ -5935,6 +5939,13 @@ |
1250 | need to propagate anything to an outer context. */ |
1251 | if ((flags & GOVD_PRIVATE) && !(flags & GOVD_PRIVATE_OUTER_REF)) |
1252 | return ret; |
1253 | + if ((flags & (GOVD_LINEAR | GOVD_LINEAR_LASTPRIVATE_NO_OUTER)) |
1254 | + == (GOVD_LINEAR | GOVD_LINEAR_LASTPRIVATE_NO_OUTER)) |
1255 | + return ret; |
1256 | + if ((flags & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE |
1257 | + | GOVD_LINEAR_LASTPRIVATE_NO_OUTER)) |
1258 | + == (GOVD_LASTPRIVATE | GOVD_LINEAR_LASTPRIVATE_NO_OUTER)) |
1259 | + return ret; |
1260 | if (ctx->outer_context |
1261 | && omp_notice_variable (ctx->outer_context, decl, in_code)) |
1262 | return true; |
1263 | @@ -6034,6 +6045,36 @@ |
1264 | return false; |
1265 | } |
1266 | |
1267 | +/* Return true if the CTX is combined with distribute and thus |
1268 | + lastprivate can't be supported. */ |
1269 | + |
1270 | +static bool |
1271 | +omp_no_lastprivate (struct gimplify_omp_ctx *ctx) |
1272 | +{ |
1273 | + do |
1274 | + { |
1275 | + if (ctx->outer_context == NULL) |
1276 | + return false; |
1277 | + ctx = ctx->outer_context; |
1278 | + switch (ctx->region_type) |
1279 | + { |
1280 | + case ORT_WORKSHARE: |
1281 | + if (!ctx->combined_loop) |
1282 | + return false; |
1283 | + if (ctx->distribute) |
1284 | + return true; |
1285 | + break; |
1286 | + case ORT_COMBINED_PARALLEL: |
1287 | + break; |
1288 | + case ORT_COMBINED_TEAMS: |
1289 | + return true; |
1290 | + default: |
1291 | + return false; |
1292 | + } |
1293 | + } |
1294 | + while (1); |
1295 | +} |
1296 | + |
1297 | /* Scan the OMP clauses in *LIST_P, installing mappings into a new |
1298 | and previous omp contexts. */ |
1299 | |
1300 | @@ -6077,6 +6118,35 @@ |
1301 | case OMP_CLAUSE_LASTPRIVATE: |
1302 | flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT; |
1303 | check_non_private = "lastprivate"; |
1304 | + decl = OMP_CLAUSE_DECL (c); |
1305 | + if (omp_no_lastprivate (ctx)) |
1306 | + { |
1307 | + notice_outer = false; |
1308 | + flags |= GOVD_LINEAR_LASTPRIVATE_NO_OUTER; |
1309 | + } |
1310 | + else if (error_operand_p (decl)) |
1311 | + goto do_add; |
1312 | + else if (outer_ctx |
1313 | + && outer_ctx->region_type == ORT_COMBINED_PARALLEL |
1314 | + && splay_tree_lookup (outer_ctx->variables, |
1315 | + (splay_tree_key) decl) == NULL) |
1316 | + omp_add_variable (outer_ctx, decl, GOVD_SHARED | GOVD_SEEN); |
1317 | + else if (outer_ctx |
1318 | + && outer_ctx->region_type == ORT_WORKSHARE |
1319 | + && outer_ctx->combined_loop |
1320 | + && splay_tree_lookup (outer_ctx->variables, |
1321 | + (splay_tree_key) decl) == NULL |
1322 | + && !omp_check_private (outer_ctx, decl, false)) |
1323 | + { |
1324 | + omp_add_variable (outer_ctx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); |
1325 | + if (outer_ctx->outer_context |
1326 | + && (outer_ctx->outer_context->region_type |
1327 | + == ORT_COMBINED_PARALLEL) |
1328 | + && splay_tree_lookup (outer_ctx->outer_context->variables, |
1329 | + (splay_tree_key) decl) == NULL) |
1330 | + omp_add_variable (outer_ctx->outer_context, decl, |
1331 | + GOVD_SHARED | GOVD_SEEN); |
1332 | + } |
1333 | goto do_add; |
1334 | case OMP_CLAUSE_REDUCTION: |
1335 | flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT; |
1336 | @@ -6089,7 +6159,68 @@ |
1337 | remove = true; |
1338 | break; |
1339 | } |
1340 | + else |
1341 | + { |
1342 | + /* For combined #pragma omp parallel for simd, need to put |
1343 | + lastprivate and perhaps firstprivate too on the |
1344 | + parallel. Similarly for #pragma omp for simd. */ |
1345 | + struct gimplify_omp_ctx *octx = outer_ctx; |
1346 | + decl = NULL_TREE; |
1347 | + if (omp_no_lastprivate (ctx)) |
1348 | + OMP_CLAUSE_LINEAR_NO_COPYOUT (c) = 1; |
1349 | + do |
1350 | + { |
1351 | + if (OMP_CLAUSE_LINEAR_NO_COPYIN (c) |
1352 | + && OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) |
1353 | + break; |
1354 | + decl = OMP_CLAUSE_DECL (c); |
1355 | + if (error_operand_p (decl)) |
1356 | + { |
1357 | + decl = NULL_TREE; |
1358 | + break; |
1359 | + } |
1360 | + if (octx |
1361 | + && octx->region_type == ORT_WORKSHARE |
1362 | + && octx->combined_loop) |
1363 | + { |
1364 | + if (octx->outer_context |
1365 | + && (octx->outer_context->region_type |
1366 | + == ORT_COMBINED_PARALLEL |
1367 | + || (octx->outer_context->region_type |
1368 | + == ORT_COMBINED_TEAMS))) |
1369 | + octx = octx->outer_context; |
1370 | + else if (omp_check_private (octx, decl, false)) |
1371 | + break; |
1372 | + } |
1373 | + else |
1374 | + break; |
1375 | + gcc_checking_assert (splay_tree_lookup (octx->variables, |
1376 | + (splay_tree_key) |
1377 | + decl) == NULL); |
1378 | + flags = GOVD_SEEN; |
1379 | + if (!OMP_CLAUSE_LINEAR_NO_COPYIN (c)) |
1380 | + flags |= GOVD_FIRSTPRIVATE; |
1381 | + if (!OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) |
1382 | + flags |= GOVD_LASTPRIVATE; |
1383 | + omp_add_variable (octx, decl, flags); |
1384 | + if (octx->outer_context == NULL) |
1385 | + break; |
1386 | + octx = octx->outer_context; |
1387 | + } |
1388 | + while (1); |
1389 | + if (octx |
1390 | + && decl |
1391 | + && (!OMP_CLAUSE_LINEAR_NO_COPYIN (c) |
1392 | + || !OMP_CLAUSE_LINEAR_NO_COPYOUT (c))) |
1393 | + omp_notice_variable (octx, decl, true); |
1394 | + } |
1395 | flags = GOVD_LINEAR | GOVD_EXPLICIT; |
1396 | + if (OMP_CLAUSE_LINEAR_NO_COPYIN (c) |
1397 | + && OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) |
1398 | + { |
1399 | + notice_outer = false; |
1400 | + flags |= GOVD_LINEAR_LASTPRIVATE_NO_OUTER; |
1401 | + } |
1402 | goto do_add; |
1403 | |
1404 | case OMP_CLAUSE_MAP: |
1405 | @@ -6543,34 +6674,6 @@ |
1406 | OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE); |
1407 | OMP_CLAUSE_PRIVATE_DEBUG (c) = 1; |
1408 | } |
1409 | - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR |
1410 | - && ctx->outer_context |
1411 | - && !(OMP_CLAUSE_LINEAR_NO_COPYIN (c) |
1412 | - && OMP_CLAUSE_LINEAR_NO_COPYOUT (c))) |
1413 | - { |
1414 | - if (ctx->outer_context->combined_loop |
1415 | - && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)) |
1416 | - { |
1417 | - n = splay_tree_lookup (ctx->outer_context->variables, |
1418 | - (splay_tree_key) decl); |
1419 | - if (n == NULL |
1420 | - || (n->value & GOVD_DATA_SHARE_CLASS) == 0) |
1421 | - { |
1422 | - int flags = GOVD_FIRSTPRIVATE; |
1423 | - /* #pragma omp distribute does not allow |
1424 | - lastprivate clause. */ |
1425 | - if (!ctx->outer_context->distribute) |
1426 | - flags |= GOVD_LASTPRIVATE; |
1427 | - if (n == NULL) |
1428 | - omp_add_variable (ctx->outer_context, decl, |
1429 | - flags | GOVD_SEEN); |
1430 | - else |
1431 | - n->value |= flags | GOVD_SEEN; |
1432 | - } |
1433 | - } |
1434 | - else if (!is_global_var (decl)) |
1435 | - omp_notice_variable (ctx->outer_context, decl, true); |
1436 | - } |
1437 | } |
1438 | break; |
1439 | |
1440 | @@ -6581,6 +6684,13 @@ |
1441 | n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); |
1442 | OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c) |
1443 | = (n->value & GOVD_FIRSTPRIVATE) != 0; |
1444 | + if (omp_no_lastprivate (ctx)) |
1445 | + { |
1446 | + if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)) |
1447 | + remove = true; |
1448 | + else |
1449 | + OMP_CLAUSE_CODE (c) = OMP_CLAUSE_PRIVATE; |
1450 | + } |
1451 | break; |
1452 | |
1453 | case OMP_CLAUSE_ALIGNED: |
1454 | @@ -6895,6 +7005,22 @@ |
1455 | gcc_unreachable (); |
1456 | } |
1457 | |
1458 | + /* Set OMP_CLAUSE_LINEAR_NO_COPYIN flag on explicit linear |
1459 | + clause for the IV. */ |
1460 | + if (simd && TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) == 1) |
1461 | + { |
1462 | + t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), 0); |
1463 | + gcc_assert (TREE_CODE (t) == MODIFY_EXPR); |
1464 | + decl = TREE_OPERAND (t, 0); |
1465 | + for (tree c = OMP_FOR_CLAUSES (for_stmt); c; c = OMP_CLAUSE_CHAIN (c)) |
1466 | + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR |
1467 | + && OMP_CLAUSE_DECL (c) == decl) |
1468 | + { |
1469 | + OMP_CLAUSE_LINEAR_NO_COPYIN (c) = 1; |
1470 | + break; |
1471 | + } |
1472 | + } |
1473 | + |
1474 | gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, |
1475 | simd ? ORT_SIMD : ORT_WORKSHARE); |
1476 | if (TREE_CODE (for_stmt) == OMP_DISTRIBUTE) |
1477 | @@ -6969,38 +7095,67 @@ |
1478 | { |
1479 | c = build_omp_clause (input_location, OMP_CLAUSE_LINEAR); |
1480 | OMP_CLAUSE_LINEAR_NO_COPYIN (c) = 1; |
1481 | - if (has_decl_expr |
1482 | - && bitmap_bit_p (has_decl_expr, DECL_UID (decl))) |
1483 | - OMP_CLAUSE_LINEAR_NO_COPYOUT (c) = 1; |
1484 | + unsigned int flags = GOVD_LINEAR | GOVD_EXPLICIT | GOVD_SEEN; |
1485 | + if ((has_decl_expr |
1486 | + && bitmap_bit_p (has_decl_expr, DECL_UID (decl))) |
1487 | + || omp_no_lastprivate (gimplify_omp_ctxp)) |
1488 | + { |
1489 | + OMP_CLAUSE_LINEAR_NO_COPYOUT (c) = 1; |
1490 | + flags |= GOVD_LINEAR_LASTPRIVATE_NO_OUTER; |
1491 | + } |
1492 | OMP_CLAUSE_DECL (c) = decl; |
1493 | OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (for_stmt); |
1494 | OMP_FOR_CLAUSES (for_stmt) = c; |
1495 | - omp_add_variable (gimplify_omp_ctxp, decl, |
1496 | - GOVD_LINEAR | GOVD_EXPLICIT | GOVD_SEEN); |
1497 | + |
1498 | + omp_add_variable (gimplify_omp_ctxp, decl, flags); |
1499 | + struct gimplify_omp_ctx *outer |
1500 | + = gimplify_omp_ctxp->outer_context; |
1501 | + if (outer && !OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) |
1502 | + { |
1503 | + if (outer->region_type == ORT_WORKSHARE |
1504 | + && outer->combined_loop) |
1505 | + { |
1506 | + if (outer->outer_context |
1507 | + && (outer->outer_context->region_type |
1508 | + == ORT_COMBINED_PARALLEL)) |
1509 | + outer = outer->outer_context; |
1510 | + else if (omp_check_private (outer, decl, false)) |
1511 | + outer = NULL; |
1512 | + } |
1513 | + else if (outer->region_type != ORT_COMBINED_PARALLEL) |
1514 | + outer = NULL; |
1515 | + if (outer) |
1516 | + { |
1517 | + omp_add_variable (outer, decl, |
1518 | + GOVD_LASTPRIVATE | GOVD_SEEN); |
1519 | + if (outer->outer_context) |
1520 | + omp_notice_variable (outer->outer_context, decl, true); |
1521 | + } |
1522 | + } |
1523 | } |
1524 | else |
1525 | { |
1526 | bool lastprivate |
1527 | = (!has_decl_expr |
1528 | - || !bitmap_bit_p (has_decl_expr, DECL_UID (decl))); |
1529 | - if (lastprivate |
1530 | - && gimplify_omp_ctxp->outer_context |
1531 | - && gimplify_omp_ctxp->outer_context->region_type |
1532 | - == ORT_WORKSHARE |
1533 | - && gimplify_omp_ctxp->outer_context->combined_loop |
1534 | - && !gimplify_omp_ctxp->outer_context->distribute) |
1535 | + || !bitmap_bit_p (has_decl_expr, DECL_UID (decl))) |
1536 | + && !omp_no_lastprivate (gimplify_omp_ctxp); |
1537 | + struct gimplify_omp_ctx *outer |
1538 | + = gimplify_omp_ctxp->outer_context; |
1539 | + if (outer && lastprivate) |
1540 | { |
1541 | - struct gimplify_omp_ctx *outer |
1542 | - = gimplify_omp_ctxp->outer_context; |
1543 | - n = splay_tree_lookup (outer->variables, |
1544 | - (splay_tree_key) decl); |
1545 | - if (n != NULL |
1546 | - && (n->value & GOVD_DATA_SHARE_CLASS) == GOVD_LOCAL) |
1547 | - lastprivate = false; |
1548 | - else if (omp_check_private (outer, decl, false)) |
1549 | - error ("lastprivate variable %qE is private in outer " |
1550 | - "context", DECL_NAME (decl)); |
1551 | - else |
1552 | + if (outer->region_type == ORT_WORKSHARE |
1553 | + && outer->combined_loop) |
1554 | + { |
1555 | + if (outer->outer_context |
1556 | + && (outer->outer_context->region_type |
1557 | + == ORT_COMBINED_PARALLEL)) |
1558 | + outer = outer->outer_context; |
1559 | + else if (omp_check_private (outer, decl, false)) |
1560 | + outer = NULL; |
1561 | + } |
1562 | + else if (outer->region_type != ORT_COMBINED_PARALLEL) |
1563 | + outer = NULL; |
1564 | + if (outer) |
1565 | { |
1566 | omp_add_variable (outer, decl, |
1567 | GOVD_LASTPRIVATE | GOVD_SEEN); |
1568 | @@ -7008,6 +7163,7 @@ |
1569 | omp_notice_variable (outer->outer_context, decl, true); |
1570 | } |
1571 | } |
1572 | + |
1573 | c = build_omp_clause (input_location, |
1574 | lastprivate ? OMP_CLAUSE_LASTPRIVATE |
1575 | : OMP_CLAUSE_PRIVATE); |
1576 | @@ -7299,7 +7455,7 @@ |
1577 | ort = ORT_TARGET_DATA; |
1578 | break; |
1579 | case OMP_TEAMS: |
1580 | - ort = ORT_TEAMS; |
1581 | + ort = OMP_TEAMS_COMBINED (expr) ? ORT_COMBINED_TEAMS : ORT_TEAMS; |
1582 | break; |
1583 | default: |
1584 | gcc_unreachable (); |
1585 | --- a/gcc/ipa-chkp.c 2015-04-06 12:41:55.000000000 +0200 |
1586 | +++ b/gcc/ipa-chkp.c 2015-05-23 11:31:36.800208969 +0200 |
1587 | @@ -264,7 +264,7 @@ |
1588 | if (!arg_type) |
1589 | return orig_type; |
1590 | |
1591 | - type = copy_node (orig_type); |
1592 | + type = build_distinct_type_copy (orig_type); |
1593 | TYPE_ARG_TYPES (type) = copy_list (TYPE_ARG_TYPES (type)); |
1594 | |
1595 | for (arg_type = TYPE_ARG_TYPES (type); |
1596 | --- a/gcc/ipa-inline.c 2015-04-03 20:09:13.000000000 +0200 |
1597 | +++ b/gcc/ipa-inline.c 2015-05-23 11:26:42.303067491 +0200 |
1598 | @@ -427,49 +427,55 @@ |
1599 | && lookup_attribute ("always_inline", |
1600 | DECL_ATTRIBUTES (callee->decl))); |
1601 | |
1602 | + /* Until GCC 4.9 we did not check the semantics alterning flags |
1603 | + bellow and inline across optimization boundry. |
1604 | + Enabling checks bellow breaks several packages by refusing |
1605 | + to inline library always_inline functions. See PR65873. |
1606 | + Disable the check for early inlining for now until better solution |
1607 | + is found. */ |
1608 | + if (always_inline && early) |
1609 | + ; |
1610 | /* There are some options that change IL semantics which means |
1611 | we cannot inline in these cases for correctness reason. |
1612 | Not even for always_inline declared functions. */ |
1613 | /* Strictly speaking only when the callee contains signed integer |
1614 | math where overflow is undefined. */ |
1615 | - if ((check_maybe_up (flag_strict_overflow) |
1616 | - /* this flag is set by optimize. Allow inlining across |
1617 | - optimize boundary. */ |
1618 | - && (!opt_for_fn (caller->decl, optimize) |
1619 | - == !opt_for_fn (callee->decl, optimize) || !always_inline)) |
1620 | - || check_match (flag_wrapv) |
1621 | - || check_match (flag_trapv) |
1622 | - /* Strictly speaking only when the callee contains memory |
1623 | - accesses that are not using alias-set zero anyway. */ |
1624 | - || check_maybe_down (flag_strict_aliasing) |
1625 | - /* Strictly speaking only when the callee uses FP math. */ |
1626 | - || check_maybe_up (flag_rounding_math) |
1627 | - || check_maybe_up (flag_trapping_math) |
1628 | - || check_maybe_down (flag_unsafe_math_optimizations) |
1629 | - || check_maybe_down (flag_finite_math_only) |
1630 | - || check_maybe_up (flag_signaling_nans) |
1631 | - || check_maybe_down (flag_cx_limited_range) |
1632 | - || check_maybe_up (flag_signed_zeros) |
1633 | - || check_maybe_down (flag_associative_math) |
1634 | - || check_maybe_down (flag_reciprocal_math) |
1635 | - /* We do not want to make code compiled with exceptions to be brought |
1636 | - into a non-EH function unless we know that the callee does not |
1637 | - throw. This is tracked by DECL_FUNCTION_PERSONALITY. */ |
1638 | - || (check_match (flag_non_call_exceptions) |
1639 | - /* TODO: We also may allow bringing !flag_non_call_exceptions |
1640 | - to flag_non_call_exceptions function, but that may need |
1641 | - extra work in tree-inline to add the extra EH edges. */ |
1642 | - && (!opt_for_fn (callee->decl, flag_non_call_exceptions) |
1643 | - || DECL_FUNCTION_PERSONALITY (callee->decl))) |
1644 | - || (check_maybe_up (flag_exceptions) |
1645 | - && DECL_FUNCTION_PERSONALITY (callee->decl)) |
1646 | - /* Strictly speaking only when the callee contains function |
1647 | - calls that may end up setting errno. */ |
1648 | - || check_maybe_up (flag_errno_math) |
1649 | - /* When devirtualization is diabled for callee, it is not safe |
1650 | - to inline it as we possibly mangled the type info. |
1651 | - Allow early inlining of always inlines. */ |
1652 | - || (!early && check_maybe_down (flag_devirtualize))) |
1653 | + else if ((check_maybe_up (flag_strict_overflow) |
1654 | + /* this flag is set by optimize. Allow inlining across |
1655 | + optimize boundary. */ |
1656 | + && (!opt_for_fn (caller->decl, optimize) |
1657 | + == !opt_for_fn (callee->decl, optimize) || !always_inline)) |
1658 | + || check_match (flag_wrapv) |
1659 | + || check_match (flag_trapv) |
1660 | + /* Strictly speaking only when the callee uses FP math. */ |
1661 | + || check_maybe_up (flag_rounding_math) |
1662 | + || check_maybe_up (flag_trapping_math) |
1663 | + || check_maybe_down (flag_unsafe_math_optimizations) |
1664 | + || check_maybe_down (flag_finite_math_only) |
1665 | + || check_maybe_up (flag_signaling_nans) |
1666 | + || check_maybe_down (flag_cx_limited_range) |
1667 | + || check_maybe_up (flag_signed_zeros) |
1668 | + || check_maybe_down (flag_associative_math) |
1669 | + || check_maybe_down (flag_reciprocal_math) |
1670 | + /* We do not want to make code compiled with exceptions to be |
1671 | + brought into a non-EH function unless we know that the callee |
1672 | + does not throw. |
1673 | + This is tracked by DECL_FUNCTION_PERSONALITY. */ |
1674 | + || (check_match (flag_non_call_exceptions) |
1675 | + /* TODO: We also may allow bringing !flag_non_call_exceptions |
1676 | + to flag_non_call_exceptions function, but that may need |
1677 | + extra work in tree-inline to add the extra EH edges. */ |
1678 | + && (!opt_for_fn (callee->decl, flag_non_call_exceptions) |
1679 | + || DECL_FUNCTION_PERSONALITY (callee->decl))) |
1680 | + || (check_maybe_up (flag_exceptions) |
1681 | + && DECL_FUNCTION_PERSONALITY (callee->decl)) |
1682 | + /* Strictly speaking only when the callee contains function |
1683 | + calls that may end up setting errno. */ |
1684 | + || check_maybe_up (flag_errno_math) |
1685 | + /* When devirtualization is diabled for callee, it is not safe |
1686 | + to inline it as we possibly mangled the type info. |
1687 | + Allow early inlining of always inlines. */ |
1688 | + || (!early && check_maybe_down (flag_devirtualize))) |
1689 | { |
1690 | e->inline_failed = CIF_OPTIMIZATION_MISMATCH; |
1691 | inlinable = false; |
1692 | @@ -484,6 +490,17 @@ |
1693 | e->inline_failed = CIF_OPTIMIZATION_MISMATCH; |
1694 | inlinable = false; |
1695 | } |
1696 | + /* If explicit optimize attribute are not used, the mismatch is caused |
1697 | + by different command line options used to build different units. |
1698 | + Do not care about COMDAT functions - those are intended to be |
1699 | + optimized with the optimization flags of module they are used in. |
1700 | + Also do not care about mixing up size/speed optimization when |
1701 | + DECL_DISREGARD_INLINE_LIMITS is set. */ |
1702 | + else if ((callee->merged |
1703 | + && !lookup_attribute ("optimize", |
1704 | + DECL_ATTRIBUTES (caller->decl))) |
1705 | + || DECL_DISREGARD_INLINE_LIMITS (callee->decl)) |
1706 | + ; |
1707 | /* If mismatch is caused by merging two LTO units with different |
1708 | optimizationflags we want to be bit nicer. However never inline |
1709 | if one of functions is not optimized at all. */ |
1710 | @@ -515,7 +532,7 @@ |
1711 | else if (opt_for_fn (callee->decl, optimize_size) |
1712 | < opt_for_fn (caller->decl, optimize_size) |
1713 | || (opt_for_fn (callee->decl, optimize) |
1714 | - >= opt_for_fn (caller->decl, optimize))) |
1715 | + > opt_for_fn (caller->decl, optimize))) |
1716 | { |
1717 | if (estimate_edge_time (e) |
1718 | >= 20 + inline_edge_summary (e)->call_stmt_time) |
1719 | --- a/gcc/lra-constraints.c 2015-04-10 18:05:26.000000000 +0200 |
1720 | +++ b/gcc/lra-constraints.c 2015-05-23 11:18:33.964634884 +0200 |
1721 | @@ -533,7 +533,7 @@ |
1722 | if (x == res || CONSTANT_P (res)) |
1723 | return res; |
1724 | return lra_eliminate_regs_1 (insn, res, GET_MODE (res), |
1725 | - 0, false, false, true); |
1726 | + false, false, 0, true); |
1727 | } |
1728 | |
1729 | /* Set up curr_operand_mode. */ |
1730 | --- a/gcc/lra-eliminations.c 2015-02-04 21:02:21.000000000 +0100 |
1731 | +++ b/gcc/lra-eliminations.c 2015-05-23 11:18:33.965634942 +0200 |
1732 | @@ -318,7 +318,9 @@ |
1733 | substitution if UPDATE_P, or the full offset if FULL_P, or |
1734 | otherwise zero. If FULL_P, we also use the SP offsets for |
1735 | elimination to SP. If UPDATE_P, use UPDATE_SP_OFFSET for updating |
1736 | - offsets of register elimnable to SP. |
1737 | + offsets of register elimnable to SP. If UPDATE_SP_OFFSET is |
1738 | + non-zero, don't use difference of the offset and the previous |
1739 | + offset. |
1740 | |
1741 | MEM_MODE is the mode of an enclosing MEM. We need this to know how |
1742 | much to adjust a register for, e.g., PRE_DEC. Also, if we are |
1743 | @@ -341,7 +343,8 @@ |
1744 | const char *fmt; |
1745 | int copied = 0; |
1746 | |
1747 | - gcc_assert (!update_p || !full_p); |
1748 | + lra_assert (!update_p || !full_p); |
1749 | + lra_assert (update_sp_offset == 0 || (!subst_p && update_p && !full_p)); |
1750 | if (! current_function_decl) |
1751 | return x; |
1752 | |
1753 | @@ -366,11 +369,14 @@ |
1754 | { |
1755 | rtx to = subst_p ? ep->to_rtx : ep->from_rtx; |
1756 | |
1757 | - if (update_p) |
1758 | - return plus_constant (Pmode, to, |
1759 | - ep->offset - ep->previous_offset |
1760 | - + (ep->to_rtx == stack_pointer_rtx |
1761 | - ? update_sp_offset : 0)); |
1762 | + if (update_sp_offset != 0) |
1763 | + { |
1764 | + if (ep->to_rtx == stack_pointer_rtx) |
1765 | + return plus_constant (Pmode, to, update_sp_offset); |
1766 | + return to; |
1767 | + } |
1768 | + else if (update_p) |
1769 | + return plus_constant (Pmode, to, ep->offset - ep->previous_offset); |
1770 | else if (full_p) |
1771 | return plus_constant (Pmode, to, |
1772 | ep->offset |
1773 | @@ -395,16 +401,15 @@ |
1774 | |
1775 | if (! update_p && ! full_p) |
1776 | return gen_rtx_PLUS (Pmode, to, XEXP (x, 1)); |
1777 | - |
1778 | - offset = (update_p |
1779 | - ? ep->offset - ep->previous_offset |
1780 | - + (ep->to_rtx == stack_pointer_rtx |
1781 | - ? update_sp_offset : 0) |
1782 | - : ep->offset); |
1783 | + |
1784 | + if (update_sp_offset != 0) |
1785 | + offset = ep->to_rtx == stack_pointer_rtx ? update_sp_offset : 0; |
1786 | + else |
1787 | + offset = (update_p |
1788 | + ? ep->offset - ep->previous_offset : ep->offset); |
1789 | if (full_p && insn != NULL_RTX && ep->to_rtx == stack_pointer_rtx) |
1790 | offset -= lra_get_insn_recog_data (insn)->sp_offset; |
1791 | - if (CONST_INT_P (XEXP (x, 1)) |
1792 | - && INTVAL (XEXP (x, 1)) == -offset) |
1793 | + if (CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) == -offset) |
1794 | return to; |
1795 | else |
1796 | return gen_rtx_PLUS (Pmode, to, |
1797 | @@ -451,12 +456,18 @@ |
1798 | { |
1799 | rtx to = subst_p ? ep->to_rtx : ep->from_rtx; |
1800 | |
1801 | - if (update_p) |
1802 | + if (update_sp_offset != 0) |
1803 | + { |
1804 | + if (ep->to_rtx == stack_pointer_rtx) |
1805 | + return plus_constant (Pmode, |
1806 | + gen_rtx_MULT (Pmode, to, XEXP (x, 1)), |
1807 | + update_sp_offset * INTVAL (XEXP (x, 1))); |
1808 | + return gen_rtx_MULT (Pmode, to, XEXP (x, 1)); |
1809 | + } |
1810 | + else if (update_p) |
1811 | return plus_constant (Pmode, |
1812 | gen_rtx_MULT (Pmode, to, XEXP (x, 1)), |
1813 | - (ep->offset - ep->previous_offset |
1814 | - + (ep->to_rtx == stack_pointer_rtx |
1815 | - ? update_sp_offset : 0)) |
1816 | + (ep->offset - ep->previous_offset) |
1817 | * INTVAL (XEXP (x, 1))); |
1818 | else if (full_p) |
1819 | { |
1820 | @@ -889,11 +900,12 @@ |
1821 | |
1822 | If REPLACE_P is false, just update the offsets while keeping the |
1823 | base register the same. If FIRST_P, use the sp offset for |
1824 | - elimination to sp. Otherwise, use UPDATE_SP_OFFSET for this. |
1825 | - Attach the note about used elimination for insns setting frame |
1826 | - pointer to update elimination easy (without parsing already |
1827 | - generated elimination insns to find offset previously used) in |
1828 | - future. */ |
1829 | + elimination to sp. Otherwise, use UPDATE_SP_OFFSET for this. If |
1830 | + UPDATE_SP_OFFSET is non-zero, don't use difference of the offset |
1831 | + and the previous offset. Attach the note about used elimination |
1832 | + for insns setting frame pointer to update elimination easy (without |
1833 | + parsing already generated elimination insns to find offset |
1834 | + previously used) in future. */ |
1835 | |
1836 | void |
1837 | eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p, |
1838 | @@ -940,6 +952,10 @@ |
1839 | rtx src = SET_SRC (old_set); |
1840 | rtx off = remove_reg_equal_offset_note (insn, ep->to_rtx); |
1841 | |
1842 | + /* We should never process such insn with non-zero |
1843 | + UPDATE_SP_OFFSET. */ |
1844 | + lra_assert (update_sp_offset == 0); |
1845 | + |
1846 | if (off != NULL_RTX |
1847 | || src == ep->to_rtx |
1848 | || (GET_CODE (src) == PLUS |
1849 | @@ -1026,7 +1042,8 @@ |
1850 | |
1851 | if (! replace_p) |
1852 | { |
1853 | - offset += (ep->offset - ep->previous_offset); |
1854 | + if (update_sp_offset == 0) |
1855 | + offset += (ep->offset - ep->previous_offset); |
1856 | if (ep->to_rtx == stack_pointer_rtx) |
1857 | { |
1858 | if (first_p) |
1859 | --- a/gcc/lra-spills.c 2015-01-15 14:28:42.000000000 +0100 |
1860 | +++ b/gcc/lra-spills.c 2015-05-23 11:18:33.965634942 +0200 |
1861 | @@ -461,7 +461,7 @@ |
1862 | { |
1863 | rtx x = lra_eliminate_regs_1 (insn, pseudo_slots[i].mem, |
1864 | GET_MODE (pseudo_slots[i].mem), |
1865 | - 0, false, false, true); |
1866 | + false, false, 0, true); |
1867 | *loc = x != pseudo_slots[i].mem ? x : copy_rtx (x); |
1868 | } |
1869 | return; |
1870 | --- a/gcc/lto-wrapper.c 2015-01-30 17:15:00.000000000 +0100 |
1871 | +++ b/gcc/lto-wrapper.c 2015-05-23 11:21:27.938957086 +0200 |
1872 | @@ -934,7 +934,7 @@ |
1873 | filename[p - argv[i]] = '\0'; |
1874 | file_offset = (off_t) loffset; |
1875 | } |
1876 | - fd = open (argv[i], O_RDONLY); |
1877 | + fd = open (filename, O_RDONLY | O_BINARY); |
1878 | if (fd == -1) |
1879 | { |
1880 | lto_argv[lto_argc++] = argv[i]; |
1881 | --- a/gcc/match.pd 2015-02-13 21:17:55.000000000 +0100 |
1882 | +++ b/gcc/match.pd 2015-05-23 11:33:11.742416376 +0200 |
1883 | @@ -702,16 +702,12 @@ |
1884 | (for integers). Avoid this if the final type is a pointer since |
1885 | then we sometimes need the middle conversion. Likewise if the |
1886 | final type has a precision not equal to the size of its mode. */ |
1887 | - (if (((inter_int && inside_int) |
1888 | - || (inter_float && inside_float) |
1889 | - || (inter_vec && inside_vec)) |
1890 | + (if (((inter_int && inside_int) || (inter_float && inside_float)) |
1891 | + && (final_int || final_float) |
1892 | && inter_prec >= inside_prec |
1893 | - && (inter_float || inter_vec |
1894 | - || inter_unsignedp == inside_unsignedp) |
1895 | - && ! (final_prec != GET_MODE_PRECISION (element_mode (type)) |
1896 | - && element_mode (type) == element_mode (inter_type)) |
1897 | - && ! final_ptr |
1898 | - && (! final_vec || inter_prec == inside_prec)) |
1899 | + && (inter_float || inter_unsignedp == inside_unsignedp) |
1900 | + && ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type)) |
1901 | + && TYPE_MODE (type) == TYPE_MODE (inter_type))) |
1902 | (ocvt @0)) |
1903 | |
1904 | /* If we have a sign-extension of a zero-extended value, we can |
1905 | --- a/gcc/omp-low.c 2015-04-03 15:35:49.000000000 +0200 |
1906 | +++ b/gcc/omp-low.c 2015-05-23 11:32:41.672037967 +0200 |
1907 | @@ -5377,7 +5377,10 @@ |
1908 | child_cfun = DECL_STRUCT_FUNCTION (child_fn); |
1909 | |
1910 | entry_bb = region->entry; |
1911 | - exit_bb = region->exit; |
1912 | + if (gimple_code (entry_stmt) == GIMPLE_OMP_TASK) |
1913 | + exit_bb = region->cont; |
1914 | + else |
1915 | + exit_bb = region->exit; |
1916 | |
1917 | bool is_cilk_for |
1918 | = (flag_cilkplus |
1919 | @@ -5436,7 +5439,9 @@ |
1920 | variable. In which case, we need to keep the assignment. */ |
1921 | if (gimple_omp_taskreg_data_arg (entry_stmt)) |
1922 | { |
1923 | - basic_block entry_succ_bb = single_succ (entry_bb); |
1924 | + basic_block entry_succ_bb |
1925 | + = single_succ_p (entry_bb) ? single_succ (entry_bb) |
1926 | + : FALLTHRU_EDGE (entry_bb)->dest; |
1927 | tree arg, narg; |
1928 | gimple parcopy_stmt = NULL; |
1929 | |
1930 | @@ -5524,14 +5529,28 @@ |
1931 | e = split_block (entry_bb, stmt); |
1932 | gsi_remove (&gsi, true); |
1933 | entry_bb = e->dest; |
1934 | - single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU; |
1935 | + edge e2 = NULL; |
1936 | + if (gimple_code (entry_stmt) == GIMPLE_OMP_PARALLEL) |
1937 | + single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU; |
1938 | + else |
1939 | + { |
1940 | + e2 = make_edge (e->src, BRANCH_EDGE (entry_bb)->dest, EDGE_ABNORMAL); |
1941 | + gcc_assert (e2->dest == region->exit); |
1942 | + remove_edge (BRANCH_EDGE (entry_bb)); |
1943 | + set_immediate_dominator (CDI_DOMINATORS, e2->dest, e->src); |
1944 | + gsi = gsi_last_bb (region->exit); |
1945 | + gcc_assert (!gsi_end_p (gsi) |
1946 | + && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); |
1947 | + gsi_remove (&gsi, true); |
1948 | + } |
1949 | |
1950 | - /* Convert GIMPLE_OMP_RETURN into a RETURN_EXPR. */ |
1951 | + /* Convert GIMPLE_OMP_{RETURN,CONTINUE} into a RETURN_EXPR. */ |
1952 | if (exit_bb) |
1953 | { |
1954 | gsi = gsi_last_bb (exit_bb); |
1955 | gcc_assert (!gsi_end_p (gsi) |
1956 | - && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); |
1957 | + && (gimple_code (gsi_stmt (gsi)) |
1958 | + == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))); |
1959 | stmt = gimple_build_return (NULL); |
1960 | gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); |
1961 | gsi_remove (&gsi, true); |
1962 | @@ -5552,6 +5571,14 @@ |
1963 | new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block); |
1964 | if (exit_bb) |
1965 | single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; |
1966 | + if (e2) |
1967 | + { |
1968 | + basic_block dest_bb = e2->dest; |
1969 | + if (!exit_bb) |
1970 | + make_edge (new_bb, dest_bb, EDGE_FALLTHRU); |
1971 | + remove_edge (e2); |
1972 | + set_immediate_dominator (CDI_DOMINATORS, dest_bb, new_bb); |
1973 | + } |
1974 | /* When the OMP expansion process cannot guarantee an up-to-date |
1975 | loop tree arrange for the child function to fixup loops. */ |
1976 | if (loops_state_satisfies_p (LOOPS_NEED_FIXUP)) |
1977 | @@ -10511,7 +10538,21 @@ |
1978 | cond_code = EQ_EXPR; |
1979 | } |
1980 | |
1981 | - cond = build2 (cond_code, boolean_type_node, fd->loop.v, fd->loop.n2); |
1982 | + tree n2 = fd->loop.n2; |
1983 | + if (fd->collapse > 1 |
1984 | + && TREE_CODE (n2) != INTEGER_CST |
1985 | + && gimple_omp_for_combined_into_p (fd->for_stmt) |
1986 | + && gimple_code (ctx->outer->stmt) == GIMPLE_OMP_FOR) |
1987 | + { |
1988 | + gomp_for *gfor = as_a <gomp_for *> (ctx->outer->stmt); |
1989 | + if (gimple_omp_for_kind (gfor) == GF_OMP_FOR_KIND_FOR) |
1990 | + { |
1991 | + struct omp_for_data outer_fd; |
1992 | + extract_omp_for_data (gfor, &outer_fd, NULL); |
1993 | + n2 = fold_convert (TREE_TYPE (n2), outer_fd.loop.n2); |
1994 | + } |
1995 | + } |
1996 | + cond = build2 (cond_code, boolean_type_node, fd->loop.v, n2); |
1997 | |
1998 | clauses = gimple_omp_for_clauses (fd->for_stmt); |
1999 | stmts = NULL; |
2000 | @@ -11158,6 +11199,10 @@ |
2001 | gimple_seq_add_stmt (&new_body, gimple_build_label (ctx->cancel_label)); |
2002 | gimple_seq_add_seq (&new_body, par_olist); |
2003 | new_body = maybe_catch_exception (new_body); |
2004 | + if (gimple_code (stmt) == GIMPLE_OMP_TASK) |
2005 | + gimple_seq_add_stmt (&new_body, |
2006 | + gimple_build_omp_continue (integer_zero_node, |
2007 | + integer_zero_node)); |
2008 | gimple_seq_add_stmt (&new_body, gimple_build_omp_return (false)); |
2009 | gimple_omp_set_body (stmt, new_body); |
2010 | |
2011 | @@ -12272,6 +12317,10 @@ |
2012 | somewhere other than the next block. This will be |
2013 | created later. */ |
2014 | cur_region->exit = bb; |
2015 | + if (cur_region->type == GIMPLE_OMP_TASK) |
2016 | + /* Add an edge corresponding to not scheduling the task |
2017 | + immediately. */ |
2018 | + make_edge (cur_region->entry, bb, EDGE_ABNORMAL); |
2019 | fallthru = cur_region->type != GIMPLE_OMP_SECTION; |
2020 | cur_region = cur_region->outer; |
2021 | break; |
2022 | @@ -12320,6 +12369,10 @@ |
2023 | } |
2024 | break; |
2025 | |
2026 | + case GIMPLE_OMP_TASK: |
2027 | + fallthru = true; |
2028 | + break; |
2029 | + |
2030 | default: |
2031 | gcc_unreachable (); |
2032 | } |
2033 | --- a/gcc/tree.h 2015-04-08 20:41:55.000000000 +0200 |
2034 | +++ b/gcc/tree.h 2015-05-23 11:32:41.673037980 +0200 |
2035 | @@ -1320,6 +1320,11 @@ |
2036 | #define OMP_PARALLEL_COMBINED(NODE) \ |
2037 | (OMP_PARALLEL_CHECK (NODE)->base.private_flag) |
2038 | |
2039 | +/* True on an OMP_TEAMS statement if it represents an explicit |
2040 | + combined teams distribute constructs. */ |
2041 | +#define OMP_TEAMS_COMBINED(NODE) \ |
2042 | + (OMP_TEAMS_CHECK (NODE)->base.private_flag) |
2043 | + |
2044 | /* True if OMP_ATOMIC* is supposed to be sequentially consistent |
2045 | as opposed to relaxed. */ |
2046 | #define OMP_ATOMIC_SEQ_CST(NODE) \ |
2047 | --- a/gcc/tree-vrp.c 2015-02-17 16:32:05.000000000 +0100 |
2048 | +++ b/gcc/tree-vrp.c 2015-05-23 11:18:33.967635057 +0200 |
2049 | @@ -874,13 +874,18 @@ |
2050 | if (is_new) |
2051 | { |
2052 | /* Do not allow transitions up the lattice. The following |
2053 | - is slightly more awkward than just new_vr->type < old_vr->type |
2054 | + is slightly more awkward than just new_vr->type < old_vr->type |
2055 | because VR_RANGE and VR_ANTI_RANGE need to be considered |
2056 | the same. We may not have is_new when transitioning to |
2057 | - UNDEFINED or from VARYING. */ |
2058 | - if (new_vr->type == VR_UNDEFINED |
2059 | - || old_vr->type == VR_VARYING) |
2060 | - set_value_range_to_varying (old_vr); |
2061 | + UNDEFINED. If old_vr->type is VARYING, we shouldn't be |
2062 | + called. */ |
2063 | + if (new_vr->type == VR_UNDEFINED) |
2064 | + { |
2065 | + BITMAP_FREE (new_vr->equiv); |
2066 | + set_value_range_to_varying (old_vr); |
2067 | + set_value_range_to_varying (new_vr); |
2068 | + return true; |
2069 | + } |
2070 | else |
2071 | set_value_range (old_vr, new_vr->type, new_vr->min, new_vr->max, |
2072 | new_vr->equiv); |
2073 | @@ -8949,6 +8954,9 @@ |
2074 | fprintf (dump_file, "\n"); |
2075 | } |
2076 | |
2077 | + if (vr_result.type == VR_VARYING) |
2078 | + return SSA_PROP_VARYING; |
2079 | + |
2080 | return SSA_PROP_INTERESTING; |
2081 | } |
2082 | |
2083 | --- a/gcc/ubsan.c 2015-04-09 21:51:08.000000000 +0200 |
2084 | +++ b/gcc/ubsan.c 2015-05-23 11:22:23.302098186 +0200 |
2085 | @@ -87,6 +87,7 @@ |
2086 | #include "builtins.h" |
2087 | #include "tree-object-size.h" |
2088 | #include "tree-eh.h" |
2089 | +#include "tree-cfg.h" |
2090 | |
2091 | /* Map from a tree to a VAR_DECL tree. */ |
2092 | |
2093 | @@ -1420,7 +1421,7 @@ |
2094 | || TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME) |
2095 | return; |
2096 | |
2097 | - bool can_throw = stmt_could_throw_p (stmt); |
2098 | + bool ends_bb = stmt_ends_bb_p (stmt); |
2099 | location_t loc = gimple_location (stmt); |
2100 | tree lhs = gimple_assign_lhs (stmt); |
2101 | tree ptype = build_pointer_type (TREE_TYPE (rhs)); |
2102 | @@ -1432,7 +1433,7 @@ |
2103 | tree mem = build2 (MEM_REF, utype, gimple_assign_lhs (g), |
2104 | build_int_cst (atype, 0)); |
2105 | tree urhs = make_ssa_name (utype); |
2106 | - if (can_throw) |
2107 | + if (ends_bb) |
2108 | { |
2109 | gimple_assign_set_lhs (stmt, urhs); |
2110 | g = gimple_build_assign (lhs, NOP_EXPR, urhs); |
2111 | @@ -1469,7 +1470,7 @@ |
2112 | gimple_set_location (g, loc); |
2113 | gsi_insert_after (gsi, g, GSI_NEW_STMT); |
2114 | |
2115 | - if (!can_throw) |
2116 | + if (!ends_bb) |
2117 | { |
2118 | gimple_assign_set_rhs_with_ops (&gsi2, NOP_EXPR, urhs); |
2119 | update_stmt (stmt); |
2120 | --- a/libstdc++-v3/include/debug/vector 2015-01-05 13:33:28.000000000 +0100 |
2121 | +++ b/libstdc++-v3/include/debug/vector 2015-05-23 11:18:33.967635057 +0200 |
2122 | @@ -69,13 +69,17 @@ |
2123 | |
2124 | _Safe_vector& |
2125 | operator=(const _Safe_vector&) noexcept |
2126 | - { _M_update_guaranteed_capacity(); } |
2127 | + { |
2128 | + _M_update_guaranteed_capacity(); |
2129 | + return *this; |
2130 | + } |
2131 | |
2132 | _Safe_vector& |
2133 | operator=(_Safe_vector&& __x) noexcept |
2134 | { |
2135 | _M_update_guaranteed_capacity(); |
2136 | __x._M_guaranteed_capacity = 0; |
2137 | + return *this; |
2138 | } |
2139 | #endif |
2140 | |
2141 | --- a/libstdc++-v3/include/experimental/any 2015-01-05 13:33:28.000000000 +0100 |
2142 | +++ b/libstdc++-v3/include/experimental/any 2015-05-23 11:20:55.285156612 +0200 |
2143 | @@ -94,7 +94,7 @@ |
2144 | std::aligned_storage<sizeof(_M_ptr), sizeof(_M_ptr)>::type _M_buffer; |
2145 | }; |
2146 | |
2147 | - template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>, |
2148 | + template<typename _Tp, typename _Safe = is_trivially_copyable<_Tp>, |
2149 | bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))> |
2150 | using _Internal = std::integral_constant<bool, _Safe::value && _Fits>; |
2151 | |
2152 | --- a/libstdc++-v3/include/std/limits 2015-01-05 13:33:28.000000000 +0100 |
2153 | +++ b/libstdc++-v3/include/std/limits 2015-05-23 11:22:05.903763794 +0200 |
2154 | @@ -1490,7 +1490,8 @@ |
2155 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ |
2156 | \ |
2157 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ |
2158 | - max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ |
2159 | + max() _GLIBCXX_USE_NOEXCEPT \ |
2160 | + { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ |
2161 | \ |
2162 | UEXT \ |
2163 | \ |