1 # Copyright 2018 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 foo$0(a int8) 5 foo$1(a int8[C1:C2]) 6 foo$2(a ptr[out, array[int32]]) 7 foo$3(a union_arg) 8 foo$4() r0 9 foo$5(a int8['a':'z']) 10 foo$6(a int8[-20:-10]) 11 foo$7(a int8[-20:20]) 12 foo$8(a ptr[in, strings]) 13 14 resource r0[intptr] 15 16 union_arg [ 17 f1 int8 18 f2 int64 19 f3 ptr[in, int32] 20 f4 r0 21 f5 const[1, intptr] 22 f6 flags[int_flags, int32] 23 f7 proc[0, 1, int16] 24 ] 25 26 strings { 27 f1 string 28 f2 string["foo"] 29 f3 string["foo", 10] 30 f4 string[string_flags1, 10] 31 f5 stringnoz 32 f6 stringnoz["foo"] 33 f7 string[""] 34 f8 string["", 10] 35 f9 stringnoz[""] 36 f11 stringnoz[string_flags1] 37 f12 string[string_flags2] 38 f13 stringnoz[string_flags2] 39 } [packed] 40 41 string_flags1 = "foo", "barbaz" 42 string_flags2 = "" 43 int_flags = 0, 1, 0xabc, 'x', -11 44 _ = 1, 2 45 _ = C1, C2 46 47 # Proc type. 48 49 proc_struct1 { 50 f1 proc[C0, 8, int8] 51 } 52 53 foo$proc1(a ptr[in, proc_struct1]) 54 55 # Len/bytesize types. 56 57 type len_templ1[DATA1, DATA2] { 58 data DATA1 59 inner len_temp2[DATA2] 60 } 61 62 type len_temp2[DATA] { 63 data DATA 64 len len[len_templ1, int8] 65 } 66 67 foo$len_templ(a ptr[in, len_templ1[int8, int16]]) 68 foo$len_var0(a ptr[in, array[string]], b len[a]) 69 foo$len_var1(a ptr[in, array[string]], b ptr[in, len[a, int32]]) 70 71 # Void type. 72 73 void0 { 74 f void 75 } 76 77 void1 { 78 f1 void 79 f2 int8 80 } 81 82 void2 { 83 f1 void 84 f2 int8 85 } 86 87 void3 [ 88 f1 void 89 f2 int8 90 ] 91 92 void4 [ 93 f1 void 94 f2 int8 95 ] [varlen] 96 97 void5 { 98 f1 void 99 f2 void 100 } 101 102 struct_with_void0 { 103 f1 int8 104 f2 array[array[void]] 105 f3 int64 106 } 107 108 struct_with_void1 { 109 f1 int8 110 f2 array[void5] 111 f3 int64 112 f4 optional[int8] 113 } 114 115 foo$void0(a ptr[in, void0]) 116 foo$void1(a ptr[in, void1]) 117 foo$void2(a ptr[in, void2]) 118 foo$void3(a ptr[in, void3]) 119 foo$void4(a ptr[in, void4]) 120 foo$void5(a ptr[in, void5]) 121 foo$void6(a ptr[in, struct_with_void0]) 122 foo$void7(a ptr[in, struct_with_void1]) 123 foo$void8(a ptr[in, void]) 124 125 # Bitfields. 126 127 bitfield0 { 128 f1 int8:1 129 f2 int8:2 130 } 131 132 foo$bitfield0(a ptr[in, bitfield0]) 133 134 # Type templates. 135 136 type type0 int8 137 type templ0[A, B] const[A, B] 138 type templ2[STR] string[STR] 139 type type3 templ2["a"] 140 141 type templ_struct0[A, B] { 142 len len[parent, int16] 143 typ const[A, int16] 144 data B 145 } [align_4] 146 147 type templ_struct1[C] { 148 f1 const[C, int8] 149 f2 int8[0:C] 150 } 151 152 union_with_templ_struct [ 153 f1 templ_struct0[C1, type0] 154 f2 templ_struct0[C2, struct0] 155 ] [varlen] 156 157 struct0 { 158 f1 int8 159 f2 int16 160 } 161 162 type templ_base0[TYPE, CONST] { 163 f1 TYPE 164 f2 const[CONST, int32] 165 } 166 167 type templ_base1[TYPE, CONST] { 168 f2 const[CONST, int8] 169 f1 TYPE 170 } 171 172 type templ_templ[BASE, CONST] { 173 f1 BASE[int8, CONST] 174 f2 BASE[int32, 0] 175 } 176 177 templ_templ_use { 178 f1 templ_templ[templ_base0, 0] 179 f2 templ_templ[templ_base1, 1] 180 } 181 182 type templ_struct2[A] templ_struct0[A, int8] 183 type templ_struct3 templ_struct2[C1] 184 type templ_struct4 templ_struct3 185 type templ_struct5 templ_struct0[C1, templ_struct0[C2, int8]] 186 type templ_struct6 templ_struct0[C1, templ_struct2[C2]] 187 type templ_union union_with_templ_struct 188 189 foo$templ0(a templ0[42, int8]) 190 foo$templ1(a ptr[in, templ_struct0[C2, int8]]) 191 foo$templ2(a ptr[in, union_with_templ_struct]) 192 foo$templ3(a ptr[in, templ_struct1[1]], b ptr[in, templ_struct1[2]]) 193 foo$templ4(a ptr[in, templ_struct1[3]]) 194 foo$templ5(a ptr[in, templ_struct1[3]]) 195 foo$templ6(a ptr[in, templ_struct4]) 196 foo$templ7(a ptr[in, templ_struct5], b ptr[in, templ_struct6], c ptr[in, templ_union], d ptr[in, type3]) 197 foo$templ8(a ptr[in, templ_templ_use]) 198 199 # Structs. 200 201 s0 { 202 f1 int8 203 } [size[64]] 204 205 s1 { 206 f1 int8 207 } [size[C2]] 208 209 foo$s0(a ptr[in, s0], b ptr[in, s1]) 210 211 # Unions. 212 213 u0 [ 214 f1 int32 215 ] 216 217 foo$u0(a ptr[in, u0]) 218 219 # fmt 220 221 foo$fmt0(a ptr[in, fmt[dec, int32[1:10]]]) 222 foo$fmt1(a ptr[in, fmt[hex, flags[int_flags]]]) 223 foo$fmt2(a ptr[in, fmt[oct, len[b]]], b ptr[in, array[int8]]) 224 foo$fmt3(a ptr[in, fmt[dec, proc[10, 20]]]) 225 foo$fmt4(a ptr[in, fmt[dec, r0]]) 226 foo$fmt5(a ptr[in, struct$fmt0]) 227 228 struct$fmt0 { 229 f0 fmt[dec, int8] 230 } 231