aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-05-16 12:16:36 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-05-16 12:16:36 +0200
commitb570947c8ad996f00aaa621a9e3dee997baa2e2e (patch)
treee28b85f2f99a2a29e7a7330a77bce84b727bb4b0 /gcc/omp-low.c
parent4156f84bfb9e0e26701a825d52da11eec26d10ff (diff)
downloadgcc-b570947c8ad996f00aaa621a9e3dee997baa2e2e.zip
gcc-b570947c8ad996f00aaa621a9e3dee997baa2e2e.tar.gz
gcc-b570947c8ad996f00aaa621a9e3dee997baa2e2e.tar.bz2
re PR middle-end/27573 (ICE with -fopenmp -fprofile-generate)
PR middle-end/27573 * omp-low.c (expand_omp_parallel): Don't assert .OMP_DATA_I = &.OMP_DATA_O is the first statement in the block, instead search for it. * gcc.dg/gomp/pr27573.c: New test. * gfortran.dg/gomp/pr27573.f90: New test. From-SVN: r113823
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2b691fa..c1441dc 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2456,7 +2456,8 @@ expand_omp_parallel (struct omp_region *region)
else
{
/* If the parallel region needs data sent from the parent
- function, then the very first statement of the parallel body
+ function, then the very first statement (except possible
+ tree profile counter updates) of the parallel body
is a copy assignment .OMP_DATA_I = &.OMP_DATA_O. Since
&.OMP_DATA_O is passed as an argument to the child function,
we need to replace it with the argument as seen by the child
@@ -2470,21 +2471,26 @@ expand_omp_parallel (struct omp_region *region)
if (OMP_PARALLEL_DATA_ARG (entry_stmt))
{
basic_block entry_succ_bb = single_succ (entry_bb);
- block_stmt_iterator si = bsi_start (entry_succ_bb);
- tree stmt;
+ block_stmt_iterator si;
- gcc_assert (!bsi_end_p (si));
-
- stmt = bsi_stmt (si);
- gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR
- && TREE_CODE (TREE_OPERAND (stmt, 1)) == ADDR_EXPR
- && TREE_OPERAND (TREE_OPERAND (stmt, 1), 0)
- == OMP_PARALLEL_DATA_ARG (entry_stmt));
-
- if (TREE_OPERAND (stmt, 0) == DECL_ARGUMENTS (child_fn))
- bsi_remove (&si, true);
- else
- TREE_OPERAND (stmt, 1) = DECL_ARGUMENTS (child_fn);
+ for (si = bsi_start (entry_succ_bb); ; bsi_next (&si))
+ {
+ tree stmt;
+
+ gcc_assert (!bsi_end_p (si));
+ stmt = bsi_stmt (si);
+ if (TREE_CODE (stmt) == MODIFY_EXPR
+ && TREE_CODE (TREE_OPERAND (stmt, 1)) == ADDR_EXPR
+ && TREE_OPERAND (TREE_OPERAND (stmt, 1), 0)
+ == OMP_PARALLEL_DATA_ARG (entry_stmt))
+ {
+ if (TREE_OPERAND (stmt, 0) == DECL_ARGUMENTS (child_fn))
+ bsi_remove (&si, true);
+ else
+ TREE_OPERAND (stmt, 1) = DECL_ARGUMENTS (child_fn);
+ break;
+ }
+ }
}
/* Declare local variables needed in CHILD_CFUN. */