Skip to content

Commit 45eaddc

Browse files
force-temp.f90: add test for INTENT(OUT) dummy argument
1 parent 84ce8ad commit 45eaddc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

flang/test/Lower/force-temp.f90

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ subroutine pass_ignore_tkr_c_2(buf)
2222
!DIR$ IGNORE_TKR (tkrcdm) buf
2323
type(*) :: buf
2424
end subroutine
25+
subroutine pass_intent_out(buf)
26+
implicit none
27+
integer, intent(out) :: buf(5)
28+
end subroutine
2529
end interface
2630
contains
2731
subroutine s1(buf)
@@ -60,4 +64,19 @@ subroutine s4(buf)
6064
! Don't create temp here
6165
call pass_ignore_tkr_c_2(buf)
6266
end subroutine
67+
subroutine s5()
68+
! TODO: pass_intent_out() has intent(out) dummy argument, so as such it
69+
! should have copy-out, but not copy-in. Unfortunately, at the moment flang
70+
! can only do copy-in/copy-out together. When this is fixed, this test should
71+
! change from 'CHECK' for hlfir.copy_in to 'CHECK-NOT' for hlfir.copy_in
72+
!CHECK-LABEL: func.func @_QMtestPs5
73+
!CHECK: hlfir.copy_in
74+
!CHECK: fir.call @_QPpass_intent_out
75+
!CHECK: hlfir.copy_out
76+
implicit none
77+
integer, target :: x(10)
78+
integer, pointer :: p(:)
79+
p => x(::2) ! pointer to non-contiguous array section
80+
call pass_intent_out(p)
81+
end subroutine
6382
end module

0 commit comments

Comments
 (0)