| 1 |
! RUN: bbc -hlfir=false %s -o - | FileCheck %s |
| 2 |
|
| 3 |
! CHECK-LABEL: func @_QPi |
| 4 |
subroutine i |
| 5 |
implicit none |
| 6 |
integer :: ctemp(10) = (/1,2,3,4,5,6,7,8,9,22/) |
| 7 |
print *, ctemp(1:10) |
| 8 |
end subroutine i |
| 9 |
|
| 10 |
! CHECK-LABEL: func @_QPs |
| 11 |
subroutine s |
| 12 |
integer, parameter :: LONGreal = 8 |
| 13 |
real (kind = LONGreal), dimension(-1:11) :: x = (/0,0,0,0,0,0,0,0,0,0,0,0,0/) |
| 14 |
real (kind = LONGreal), dimension(0:12) :: g = (/0,0,0,0,0,0,0,0,0,0,0,0,0/) |
| 15 |
real (kind = LONGreal) :: gs(13) |
| 16 |
x(1) = 4.0 |
| 17 |
g(1) = 5.0 |
| 18 |
gs = g(0:12:1) + x(11:(-1):(-1)) |
| 19 |
print *, gs |
| 20 |
!print *, dot_product(g(0:12:1), x(11:(-1):(-1))) |
| 21 |
end subroutine s |
| 22 |
|
| 23 |
! CHECK-LABEL: func @_QPs2 |
| 24 |
subroutine s2 |
| 25 |
real :: x(10) |
| 26 |
x = 0.0 |
| 27 |
! CHECK: fir.call @_FortranAioBeginExternalListOutput |
| 28 |
print *, x |
| 29 |
! CHECK: %[[s:.*]] = fir.slice {{.*}} !fir.slice<1> |
| 30 |
! CHECK: %[[p:.*]] = fir.array_coor %{{.*}} [%[[s]]] % |
| 31 |
! CHECK: fir.store %{{.*}} to %[[p]] : !fir.ref<f32> |
| 32 |
x(1:10:3) = 2.0 |
| 33 |
! CHECK: fir.call @_FortranAioBeginExternalListOutput |
| 34 |
print *, x |
| 35 |
end subroutine s2 |
| 36 |
|
| 37 |
! CHECK-LABEL: func @_QQmain |
| 38 |
program main |
| 39 |
integer :: A(10) |
| 40 |
A(1) = 1 |
| 41 |
A(2) = 2 |
| 42 |
A(3) = 3 |
| 43 |
print *, A |
| 44 |
! CHECK: %[[A:.*]] = fir.address_of(@_QFEa) |
| 45 |
! CHECK: %[[shape:.*]] = fir.shape %c10 |
| 46 |
! CHECK: %[[slice:.*]] = fir.slice % |
| 47 |
! CHECK: fir.embox %[[A]](%[[shape]]) [%[[slice]]] : |
| 48 |
print*, A(1:3:1) |
| 49 |
call s |
| 50 |
call i |
| 51 |
end program main |