llvm-project/flang/test/Lower/array-constructor-1.f90
Eugene Epshteyn 256ec23ebe
[flang][NFC] Converted five tests from old lowering to new lowering (part 3) (#174345)
Tests converted: always-execute-loop-body.f90, arithmetic-goto.f90,
array-constructor-1.f90, array-constructor-index.f90, array-derived.f90
2026-01-06 09:31:53 -05:00

47 lines
1.3 KiB
Fortran

! RUN: bbc -emit-fir -o - %s | FileCheck %s
module units
integer, parameter :: preconnected_unit(3) = [0, 5, 6]
contains
! CHECK-LABEL: _QMunitsPis_preconnected_unit
logical function is_preconnected_unit(u)
! CHECK: [[units_ssa:%[0-9]+]] = fir.address_of(@_QMunitsECpreconnected_unit) : !fir.ref<!fir.array<3xi32>>
! CHECK: [[units_decl:%[0-9]+]] = fir.declare [[units_ssa]]
integer :: u
integer :: i
is_preconnected_unit = .true.
do i = lbound(preconnected_unit,1), ubound(preconnected_unit,1)
! CHECK: fir.array_coor [[units_decl]]
if (preconnected_unit(i) == u) return
end do
is_preconnected_unit = .false.
end function
end module units
! CHECK-LABEL: _QPcheck_units
subroutine check_units
use units
do i=-1,8
if (is_preconnected_unit(i)) print*, i
enddo
end
! CHECK-LABEL: _QPzero
subroutine zero
complex, parameter :: a(0) = [(((k,k=1,10),j=-2,2,-1),i=2,-2,-2)]
complex, parameter :: b(0) = [(7,i=3,-3)]
! CHECK: fir.address_of(@_QQro.0xz4.null.0) : !fir.ref<!fir.array<0xcomplex<f32>>>
print*, '>', a, '<'
print*, '>', b, '<'
end
! CHECK-LABEL: _QQmain
program prog
call check_units
call zero
end
! CHECK: fir.global internal @_QFzeroECa constant : !fir.array<0xcomplex<f32>>
! CHECK: %0 = fir.undefined !fir.array<0xcomplex<f32>>
! CHECK: fir.has_value %0 : !fir.array<0xcomplex<f32>>