------- Comment #5 from jakub at gcc dot gnu dot org 2008-01-04 17:09 ------- That's only part of the problem. The other is that ompexpand is very upset if new basic blocks are inserted in unexpected places, e.g. on the BRANCH_EDGE from OMP_FOR bb or on the FALLTHRU_EDGE from OMP_CONTINUE. expand_omp_for_* changes the CFG a lot and so adding profile insns on the edges it will revamp is premature. The following patch lets me make -C gcc -k check RUNTESTFLAGS='--target_board=unix/-fprofile-arcs gomp.exp' and make -C */libgomp -k check RUNTESTFLAGS='--target_board=unix/-fprofile-arcs' (without it there are many ICEs): --- tree-profile.c.jj16 2007-12-07 12:21:06.000000000 +0100 +++ tree-profile.c 2008-01-04 17:57:28.000000000 +0100 @@ -171,6 +171,19 @@ tree_gen_edge_profiler (int edgeno, edge { tree ref, one, stmt1, stmt2, stmt3;
+ if (flag_openmp) + { + tree stmt = last_stmt (e->src); + if (stmt) + { + /* Avoid inserting profiling instructions on edges + which OpenMP expand will replace. */ + if (TREE_CODE (stmt) == OMP_CONTINUE + || TREE_CODE (stmt) == OMP_FOR) + return; + } + } + /* We share one temporary variable declaration per function. This gets re-set in tree_profiling. */ if (gcov_type_tmp_var == NULL_TREE) In addition to this some bit in cfun? to avoid pass_tree_profile would be needed and expand_omp_parallel should set that for the child fns it creates. Is this ok for you? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34610