1! RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s 2! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s 3 4subroutine sectionsReduction(x) 5 real, dimension(:) :: x 6 7 !$omp parallel 8 !$omp sections reduction(+:x) 9 x = x + 1 10 !$omp section 11 x = x + 2 12 !$omp end sections 13 !$omp end parallel 14end subroutine 15 16 17! CHECK-LABEL: omp.declare_reduction @add_reduction_byref_box_Uxf32 : !fir.ref<!fir.box<!fir.array<?xf32>>> alloc { 18! [...] 19! CHECK: omp.yield 20! CHECK-LABEL: } init { 21! [...] 22! CHECK: omp.yield 23! CHECK-LABEL: } combiner { 24! [...] 25! CHECK: omp.yield 26! CHECK-LABEL: } cleanup { 27! [...] 28! CHECK: omp.yield 29! CHECK: } 30 31! CHECK-LABEL: func.func @_QPsectionsreduction( 32! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "x"}) { 33! CHECK: %[[VAL_1:.*]] = fir.dummy_scope : !fir.dscope 34! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_1]] {uniq_name = "_QFsectionsreductionEx"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> (!fir.box<!fir.array<?xf32>>, !fir.box<!fir.array<?xf32>>) 35! CHECK: omp.parallel { 36! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.array<?xf32>> 37! CHECK: fir.store %[[VAL_2]]#1 to %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?xf32>>> 38! CHECK: omp.sections reduction(byref @add_reduction_byref_box_Uxf32 %[[VAL_3]] -> %[[VAL_4:.*]] : !fir.ref<!fir.box<!fir.array<?xf32>>>) { 39! CHECK: omp.section { 40! CHECK: ^bb0(%[[VAL_5:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>): 41! [...] 42! CHECK: omp.terminator 43! CHECK: } 44! CHECK: omp.section { 45! CHECK: ^bb0(%[[VAL_23:.*]]: !fir.ref<!fir.box<!fir.array<?xf32>>>): 46! [...] 47! CHECK: omp.terminator 48! CHECK: } 49! CHECK: omp.terminator 50! CHECK: } 51! CHECK: omp.terminator 52! CHECK: } 53! CHECK: return 54! CHECK: } 55 56