File: basic-function.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (150 lines) | stat: -rw-r--r-- 3,738 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
! RUN: bbc %s -o "-" -emit-fir | FileCheck %s

integer(1) function fct1()
end
! CHECK-LABEL: func @_QPfct1() -> i8
! CHECK:         return %{{.*}} : i8

integer(2) function fct2()
end
! CHECK-LABEL: func @_QPfct2() -> i16
! CHECK:         return %{{.*}} : i16

integer(4) function fct3()
end
! CHECK-LABEL: func @_QPfct3() -> i32
! CHECK:         return %{{.*}} : i32

integer(8) function fct4()
end
! CHECK-LABEL: func @_QPfct4() -> i64
! CHECK:         return %{{.*}} : i64

integer(16) function fct5()
end
! CHECK-LABEL: func @_QPfct5() -> i128
! CHECK:         return %{{.*}} : i128

function fct()
  integer :: fct
end
! CHECK-LABEL: func @_QPfct() -> i32
! CHECK:         return %{{.*}} : i32

function fct_res() result(res)
  integer :: res
end
! CHECK-LABEL: func @_QPfct_res() -> i32
! CHECK:         return %{{.*}} : i32

integer function fct_body()
  goto 1
  1 stop
end

! CHECK-LABEL: func @_QPfct_body() -> i32
! CHECK:         cf.br ^bb1
! CHECK:       ^bb1
! CHECK:         %{{.*}} = fir.call @_FortranAStopStatement
! CHECK:         fir.unreachable

function fct_iarr1()
  integer, dimension(10) :: fct_iarr1
end

! CHECK-LABEL: func @_QPfct_iarr1() -> !fir.array<10xi32>
! CHECK:         return %{{.*}} : !fir.array<10xi32>

function fct_iarr2()
  integer, dimension(10, 20) :: fct_iarr2
end

! CHECK-LABEL: func @_QPfct_iarr2() -> !fir.array<10x20xi32>
! CHECK:         return %{{.*}} : !fir.array<10x20xi32>

logical(1) function lfct1()
end
! CHECK-LABEL: func @_QPlfct1() -> !fir.logical<1>
! CHECK:         return %{{.*}} : !fir.logical<1>

logical(2) function lfct2()
end
! CHECK-LABEL: func @_QPlfct2() -> !fir.logical<2>
! CHECK:         return %{{.*}} : !fir.logical<2>

logical(4) function lfct3()
end
! CHECK-LABEL: func @_QPlfct3() -> !fir.logical<4>
! CHECK:         return %{{.*}} : !fir.logical<4>

logical(8) function lfct4()
end
! CHECK-LABEL: func @_QPlfct4() -> !fir.logical<8>
! CHECK:         return %{{.*}} : !fir.logical<8>

real(2) function rfct1()
end
! CHECK-LABEL: func @_QPrfct1() -> f16
! CHECK:         return %{{.*}} : f16

real(3) function rfct2()
end
! CHECK-LABEL: func @_QPrfct2() -> bf16
! CHECK:         return %{{.*}} : bf16

real function rfct3()
end
! CHECK-LABEL: func @_QPrfct3() -> f32
! CHECK:         return %{{.*}} : f32

real(8) function rfct4()
end
! CHECK-LABEL: func @_QPrfct4() -> f64
! CHECK:         return %{{.*}} : f64

real(10) function rfct5()
end
! CHECK-LABEL: func @_QPrfct5() -> f80
! CHECK:         return %{{.*}} : f80

real(16) function rfct6()
end
! CHECK-LABEL: func @_QPrfct6() -> f128
! CHECK:         return %{{.*}} : f128

complex(2) function cplxfct1()
end
! CHECK-LABEL: func @_QPcplxfct1() -> !fir.complex<2>
! CHECK:         return %{{.*}} : !fir.complex<2>

complex(3) function cplxfct2()
end
! CHECK-LABEL: func @_QPcplxfct2() -> !fir.complex<3>
! CHECK:         return %{{.*}} : !fir.complex<3>

complex(4) function cplxfct3()
end
! CHECK-LABEL: func @_QPcplxfct3() -> !fir.complex<4>
! CHECK:         return %{{.*}} : !fir.complex<4>

complex(8) function cplxfct4()
end
! CHECK-LABEL: func @_QPcplxfct4() -> !fir.complex<8>
! CHECK:         return %{{.*}} : !fir.complex<8>

complex(10) function cplxfct5()
end
! CHECK-LABEL: func @_QPcplxfct5() -> !fir.complex<10>
! CHECK:         return %{{.*}} : !fir.complex<10>

complex(16) function cplxfct6()
end
! CHECK-LABEL: func @_QPcplxfct6() -> !fir.complex<16>
! CHECK:         return %{{.*}} : !fir.complex<16>

function fct_with_character_return(i)
  character(10) :: fct_with_character_return
  integer :: i
end
! CHECK-LABEL: func @_QPfct_with_character_return(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.char<1,10>>{{.*}}, %{{.*}}: index{{.*}}, %{{.*}}: !fir.ref<i32>{{.*}}) -> !fir.boxchar<1> {