http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46886
--- Comment #4 from sebpop at gmail dot com <sebpop at gmail dot com> 2011-02-04 20:30:46 UTC --- On Tue, Jan 18, 2011 at 11:00, jakub at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org> wrote: > Seems one extra incorrect iteration is added after GOMP_parallel_end: That extra iteration is added by this call: /* Ensure that the exit condition is the first statement in the loop. */ transform_to_exit_first_loop (loop, reduction_list, nit); /* Moves the exit condition of LOOP to the beginning of its header, and duplicates the part of the last iteration that gets disabled to the exit of the loop. NIT is the number of iterations of the loop (used to initialize the variables in the duplicated part). TODO: the common case is that latch of the loop is empty and immediately follows the loop exit. In this case, it would be better not to copy the body of the loop, but only move the entry of the loop directly before the exit check and increase the number of iterations of the loop by one. This may need some additional preconditioning in case NIT = ~0. REDUCTION_LIST describes the reductions in LOOP. */ static void transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit)