33 lines · plain
1! Fixes a bug when a block variable is marked as pre-determined private. In such2! case, we can simply ignore privatizing that symbol within the context of the3! currrent OpenMP construct since the "private" allocation for the symbol will4! be emitted within the nested block anyway.5 6! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s7 8subroutine block_predetermined_privatization9 implicit none10 integer :: i11 12 !$omp parallel13 do i=1,1014 block15 integer :: j16 do j=1,1017 end do18 end block19 end do20 !$omp end parallel21end subroutine22 23! CHECK-LABEL: func.func @_QPblock_predetermined_privatization() {24! CHECK: %[[I_DECL:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "{{.*}}Ei"}25! CHECK: omp.parallel private(@{{.*}}Ei_private_i32 %[[I_DECL]]#0 -> %{{.*}} : !fir.ref<i32>) {26! CHECK: fir.do_loop {{.*}} {27! Verify that `j` is allocated whithin the same scope of its block (i.e. inside28! the `parallel` loop).29! CHECK: fir.alloca i32 {bindc_name = "j", {{.*}}}30! CHECK: }31! CHECK: }32! CHECK: }33