brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1861b39 Raw
44 lines · plain
1! Regression test for crash compiling privatizer for a pointer to an array.2! The crash was because the fir.embox was not given a shape but it needs one.3 4!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s5 6! ALLOCATABLE case (2nd subroutine)7!CHECK-LABEL: omp.private {type = firstprivate}8!CHECK-SAME: @{{.*}} : !fir.box<!fir.heap<!fir.array<?x!fir.type<{{.*}}>>>> init {9!CHECK:        if %{{.*}} {10!CHECK:        %[[SHAPE:.*]] = fir.shape11!CHECK:        %[[BOX:.*]] = fir.embox %{{.*}}(%[[SHAPE]])12!CHECK:        } else {13 14! POINTER case (1st subroutine)15!CHECK-LABEL: omp.private {type = firstprivate}16!CHECK-SAME: @{{.*}} : !fir.box<!fir.ptr<!fir.array<?x!fir.type<{{.*}}>>>> init {17!CHECK:        %[[SHAPE:.*]] = fir.shape18!CHECK:        %[[ADDR:.*]] = fir.zero_bits19!CHECK:        %[[BOX:.*]] = fir.embox %[[ADDR]](%[[SHAPE]])20 21subroutine pointer_to_array_derived22  type t23    integer :: i24  end type25  type(t), pointer :: a(:)26  allocate(a(1))27  a(1)%i = 228  !$omp parallel firstprivate(a)29  if (a(1)%i/=2) stop 230  !$omp end parallel31end subroutine32 33subroutine allocatable_array_derived34  type t35    integer :: i36  end type37  type(t), allocatable :: a(:)38  allocate(a(1))39  a(1)%i = 240  !$omp parallel firstprivate(a)41  if (a(1)%i/=2) stop 242  !$omp end parallel43end subroutine44