+2015-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/66820
+ * gimplify.c (maybe_fold_stmt): Don't fold in ORT_PARALLEL
+ or ORT_TASK contexts.
+ * omp-low.c (lower_omp): Call fold_stmt even if taskreg_nesting_level
+ is non-zero.
+
2015-07-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* expr.c (expand_cond_expr_using_cmove): Fix typos in comment
return gimplify_expr (arg_p, pre_p, NULL, test, fb);
}
-/* Don't fold inside offloading regions: it can break code by adding decl
- references that weren't in the source. We'll do it during omplower pass
- instead. */
+/* Don't fold inside offloading or taskreg regions: it can break code by
+ adding decl references that weren't in the source. We'll do it during
+ omplower pass instead. */
static bool
maybe_fold_stmt (gimple_stmt_iterator *gsi)
{
struct gimplify_omp_ctx *ctx;
for (ctx = gimplify_omp_ctxp; ctx; ctx = ctx->outer_context)
- if (ctx->region_type == ORT_TARGET)
+ if (ctx->region_type == ORT_TARGET
+ || (ctx->region_type & (ORT_PARALLEL | ORT_TASK)) != 0)
return false;
return fold_stmt (gsi);
}
for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (&gsi))
lower_omp_1 (&gsi, ctx);
/* During gimplification, we haven't folded statments inside offloading
- regions (gimplify.c:maybe_fold_stmt); do that now. */
- if (target_nesting_level)
+ or taskreg regions (gimplify.c:maybe_fold_stmt); do that now. */
+ if (target_nesting_level || taskreg_nesting_level)
for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (&gsi))
fold_stmt (&gsi);
input_location = saved_location;
+2015-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/66820
+ * gcc.dg/gomp/pr66820.c: New test.
+
2015-07-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65592
--- /dev/null
+/* PR middle-end/66820 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void bar (char *);
+
+void
+foo (char **x)
+{
+#pragma omp parallel for
+ for (int i = 0; i < 16; i++)
+ {
+ char y[50];
+ __builtin_strcpy (y, x[i]);
+ __builtin_strcat (y, "foo");
+ bar (y);
+ }
+}