https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46032

--- Comment #20 from vries at gcc dot gnu.org ---
This patch seems to have the desired effect on the original testcase: 
...
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 830db75..996756b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -9361,6 +9361,7 @@ expand_omp_for_static_nochunk (struct omp_region *region,
       if (collapse_bb == NULL)
        loop->latch = cont_bb;
       add_loop (loop, body_bb->loop_father);
+      loop->safelen = INT_MAX;
     }
 }
...

AFAIU, adding the omp for to the loop is an assertion that the loop is
independent. It seems reasonable to assume that if the original loop was
independent, the loop operating on a slice of the original iteration space will
be independent as well.

Reply via email to