This fixes the latch block used for the new loop in
expand_omp_atomic_pipeline.

Bootstrap / regtest pending on x86_64-unknown-linux-gnu.

Richard.

2013-05-27  Richard Biener  <rguent...@suse.de>

        PR middle-end/57412
        * omp-low.c (expand_omp_atomic_pipeline): Use the correct latch
        block for the new loop.

        * gcc.dg/gomp/pr57412.c: New testcase.

Index: gcc/omp-low.c
===================================================================
*** gcc/omp-low.c       (revision 199356)
--- gcc/omp-low.c       (working copy)
*************** expand_omp_atomic_pipeline (basic_block
*** 5665,5671 ****
  
    struct loop *loop = alloc_loop ();
    loop->header = loop_header;
!   loop->latch = loop_header;
    add_loop (loop, loop_header->loop_father);
  
    if (gimple_in_ssa_p (cfun))
--- 5665,5671 ----
  
    struct loop *loop = alloc_loop ();
    loop->header = loop_header;
!   loop->latch = store_bb;
    add_loop (loop, loop_header->loop_father);
  
    if (gimple_in_ssa_p (cfun))
Index: gcc/testsuite/gcc.dg/gomp/pr57412.c
===================================================================
*** gcc/testsuite/gcc.dg/gomp/pr57412.c (revision 0)
--- gcc/testsuite/gcc.dg/gomp/pr57412.c (working copy)
***************
*** 0 ****
--- 1,10 ----
+ /* { dg-do compile } */
+ 
+ int thr;
+ #pragma omp threadprivate (thr)
+ int foo ()
+ {
+   int l;
+ #pragma omp parallel copyin (thr) reduction (||:l)
+   ;
+ }

Reply via email to