re PR middle-end/66820 (internal compiler error: in get_expr_operands, at tree-ssa-operands.c:910)

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.

	* gcc.dg/gomp/pr66820.c: New test.

From-SVN: r225661
This commit is contained in:
Jakub Jelinek 2015-07-10 12:26:19 +02:00 committed by Jakub Jelinek
parent e9f4322e78
commit d26fc9797b
5 changed files with 38 additions and 6 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -2245,16 +2245,17 @@ gimplify_arg (tree *arg_p, gimple_seq *pre_p, location_t call_location)
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);
}

View File

@ -11890,8 +11890,8 @@ lower_omp (gimple_seq *body, omp_context *ctx)
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;

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,18 @@
/* 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);
}
}