Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / dummy-arguments.f90
blobd7033db548a8458df2dbb6bd8fb81afddb6392fe
1 ! RUN: bbc %s -o - | FileCheck %s
3 ! CHECK-LABEL: _QQmain
4 program test1
5 ! CHECK-DAG: %[[TMP:.*]] = fir.alloca
6 ! CHECK-DAG: %[[TEN:.*]] = arith.constant
7 ! CHECK: fir.store %[[TEN]] to %[[TMP]]
8 ! CHECK-NEXT: fir.call @_QFPfoo
9 call foo(10)
10 contains
12 ! CHECK-LABEL: func @_QFPfoo
13 subroutine foo(avar1)
14 integer :: avar1
15 ! integer :: my_data, my_data2
16 ! DATA my_data / 150 /
17 ! DATA my_data2 / 150 /
18 ! print *, my_data, my_data2
19 print *, avar1
20 end subroutine
21 ! CHECK: }
22 end program test1
24 ! CHECK-LABEL: func @_QPsub2
25 function sub2(r)
26 real :: r(20)
27 ! CHECK: %[[coor:.*]] = fir.coordinate_of %arg0
28 ! CHECK: = fir.call @_QPf(%[[coor]]) {{.*}}: (!fir.ref<f32>) -> f32
29 sub2 = f(r(1))
30 ! CHECK: return %{{.*}} : f32
31 end function sub2
33 ! Test TARGET attribute lowering
34 ! CHECK-LABEL: func @_QPtest_target(
35 ! CHECK-SAME: !fir.ref<i32> {fir.bindc_name = "i", fir.target},
36 ! CHECK-SAME: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "x", fir.target})
37 subroutine test_target(i, x)
38 integer, target :: i
39 real, target :: x(:)
40 print *, xs, xa
41 end subroutine