Skip to content

Commit cf32305

Browse files
committed
Add a new test to check passing %VAL to a VALUE argument
1 parent b65fad2 commit cf32305

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
! RUN: flang -fc1 -emit-hlfir %s -o - | FileCheck %s
2+
3+
program main
4+
logical::a1
5+
data a1/.true./
6+
call sb(%val(a1))
7+
! CHECK: %[[A1_ADDR:.*]] = fir.address_of(@_QFEa1) : !fir.ref<!fir.logical<4>>
8+
! CHECK: %[[A1_DECL:.*]]:2 = hlfir.declare %[[A1_ADDR]] {uniq_name = "_QFEa1"} : (!fir.ref<!fir.logical<4>>) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
9+
! CHECK: %[[A1_LOADED:.*]] = fir.load %[[A1_DECL]]#0 : !fir.ref<!fir.logical<4>>
10+
! CHECK: fir.call @_QFPsb(%[[A1_LOADED]]) fastmath<contract> : (!fir.logical<4>) -> ()
11+
! CHECK: func.func private @_QFPsb(%[[SB_ARG:.*]]: !fir.logical<4> {fir.bindc_name = "x1"})
12+
write(6,*) "a1 = ", a1
13+
contains
14+
subroutine sb(x1)
15+
logical, value :: x1
16+
end subroutine sb
17+
end program main

0 commit comments

Comments
 (0)