b357f682db
PR debug/36617 * tree-cfg.c (struct move_stmt_d): Replace block field with orig_block and new_block fields. (move_stmt_r): Only set TREE_BLOCK to p->new_block if if it used to be NULL, p->orig_block or if p->orig_block is NULL. (move_block_to_fn): Replace vars_map and new_label_map arguments with struct move_stmt_d pointer. (replace_block_vars_by_duplicates): New function. (move_sese_region_to_fn): Add ORIG_BLOCK argument. Adjust move_block_to_fn caller. If ORIG_BLOCK is non-NULL, move over all subblocks of ORIG_BLOCK to the new function. Call replace_block_vars_by_duplicates. * tree-flow.h (move_sese_region_to_fn): Adjust prototype. * omp-low.c (expand_omp_taskreg): Set TREE_USED on DECL_INITIAL BLOCK of the new function. Adjust move_sese_region_to_fn caller. Prune vars with original DECL_CONTEXT from child_cfun->local_decls. (expand_omp): Temporarily set input_location to the location of region's controlling stmt. (lower_omp_sections, lower_omp_for): Add a BLOCK into outermost BIND_EXPR, push ctx->block_vars and gimplification vars into the BIND_EXPR and its block's BLOCK_VARS instead of directly into dest function. (lower_omp_single): Set TREE_USED on the BIND_EXPR's BLOCK if there are any BLOCK_VARS. (lower_omp_taskreg): Set BLOCK on a BIND_EXPR containing the OMP_PARALLEL or OMP_TASK stmt. (lower_omp): Save and restore input_location around the lower_omp_1 call. * testsuite/libgomp.c/debug-1.c: New test. From-SVN: r137198
163 lines
2.4 KiB
C
163 lines
2.4 KiB
C
/* PR debug/36617 */
|
|
/* { dg-do run } */
|
|
/* { dg-options "-g -fopenmp -O0" } */
|
|
|
|
int
|
|
f1 (void)
|
|
{
|
|
int v1i, v1j, v1k, v1l = 0;
|
|
v1i = 6;
|
|
v1j = 8;
|
|
#pragma omp parallel private (v1k) firstprivate (v1j) shared (v1i) reduction (+:v1l)
|
|
{
|
|
v1k = v1i + v1j;
|
|
{
|
|
int v1m = 1;
|
|
v1l = v1m;
|
|
}
|
|
}
|
|
return v1l;
|
|
}
|
|
|
|
int v2k = 9;
|
|
|
|
int
|
|
f2 (void)
|
|
{
|
|
int v2i = 6, v2j = 7;
|
|
#pragma omp single private (v2i) firstprivate (v2k)
|
|
{
|
|
int v2l = v2j + v2k;
|
|
v2i = 8;
|
|
v2k = 10;
|
|
v2j = v2l + v2i;
|
|
}
|
|
return v2i + v2j;
|
|
}
|
|
|
|
int
|
|
f3 (void)
|
|
{
|
|
int v3i = 6, v3j = 7, v3k = 9;
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp master
|
|
v3i++;
|
|
#pragma omp single private (v3i) firstprivate (v3k)
|
|
{
|
|
int v3l = v3j + v3k;
|
|
v3i = 8;
|
|
v3k = 10;
|
|
v3j = v3l + v3i;
|
|
}
|
|
#pragma omp atomic
|
|
v3k++;
|
|
}
|
|
return v3i + v3j;
|
|
}
|
|
|
|
int v4k = 9, v4l = 0;
|
|
|
|
int
|
|
f4 (void)
|
|
{
|
|
int v4i = 6, v4j = 7, v4n = 0;
|
|
#pragma omp sections private (v4i) firstprivate (v4k) reduction (+:v4l)
|
|
{
|
|
#pragma omp section
|
|
{
|
|
int v4m = v4j + v4k;
|
|
v4i = 8;
|
|
v4k = 10;
|
|
v4l++;
|
|
v4n = v4m + v4i;
|
|
}
|
|
#pragma omp section
|
|
{
|
|
int v4o = v4j + v4k;
|
|
v4i = 10;
|
|
v4k = 11;
|
|
v4l++;
|
|
}
|
|
}
|
|
return v4i + v4j + v4l + v4n;
|
|
}
|
|
|
|
int
|
|
f5 (void)
|
|
{
|
|
int v5i = 6, v5j = 7, v5k = 9, v5l = 0, v5n = 0, v5p = 0;
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp master
|
|
v5p++;
|
|
#pragma omp sections private (v5i) firstprivate (v5k) reduction (+:v5l)
|
|
{
|
|
#pragma omp section
|
|
{
|
|
int v5m = v5j + v5k;
|
|
v5i = 8;
|
|
v5k = 10;
|
|
v5l++;
|
|
v5n = v5m + v5i;
|
|
}
|
|
#pragma omp section
|
|
{
|
|
int v5o = v5j + v5k;
|
|
v5i = 10;
|
|
v5k = 11;
|
|
v5l++;
|
|
}
|
|
}
|
|
}
|
|
return v5i + v5j + v5l + v5n + v5p;
|
|
}
|
|
|
|
int v6k = 9, v6l = 0;
|
|
|
|
int
|
|
f6 (void)
|
|
{
|
|
int v6i = 6, v6j = 7, v6n = 0;
|
|
#pragma omp for private (v6i) firstprivate (v6k) reduction (+:v6l)
|
|
for (v6n = 0; v6n < 3; v6n++)
|
|
{
|
|
int v6m = v6j + v6k;
|
|
v6i = 8;
|
|
v6l++;
|
|
}
|
|
return v6i + v6j + v6k + v6l + v6n;
|
|
}
|
|
|
|
int
|
|
f7 (void)
|
|
{
|
|
int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp master
|
|
v7o++;
|
|
#pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
|
|
for (v7n = 0; v7n < 3; v7n++)
|
|
{
|
|
int v7m = v7j + v7k;
|
|
v7i = 8;
|
|
v7l++;
|
|
}
|
|
}
|
|
return v7i + v7j + v7k + v7l + v7n;
|
|
}
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
f1 ();
|
|
f2 ();
|
|
f3 ();
|
|
f4 ();
|
|
f5 ();
|
|
f6 ();
|
|
f7 ();
|
|
return 0;
|
|
}
|