1// HLFIR ops diagnotic tests 2 3// RUN: fir-opt -strict-intrinsic-verifier -split-input-file -verify-diagnostics %s 4 5func.func @bad_declare(%arg0: !fir.ref<f32>) { 6 // expected-error@+1 {{'hlfir.declare' op first result type is inconsistent with variable properties: expected '!fir.ref<f32>'}} 7 %0:2 = hlfir.declare %arg0 {uniq_name = "x"} : (!fir.ref<f32>) -> (!fir.box<f32>, !fir.ref<f32>) 8 return 9} 10 11// ----- 12func.func @bad_declare_lower_bounds(%arg0: !fir.ref<!fir.array<2x4xf32>>) { 13 %c1 = arith.constant 1 : index 14 %c2 = arith.constant 2 : index 15 %c3 = arith.constant 3 : index 16 %c4 = arith.constant 4 : index 17 %shape = fir.shape_shift %c1, %c2, %c3, %c4 : (index, index, index, index) -> !fir.shapeshift<2> 18 // expected-error@+1 {{'hlfir.declare' op first result type is inconsistent with variable properties: expected '!fir.box<!fir.array<2x4xf32>>'}} 19 %0:2 = hlfir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.ref<!fir.array<2x4xf32>>, !fir.shapeshift<2>) -> (!fir.ref<!fir.array<2x4xf32>>, !fir.ref<!fir.array<2x4xf32>>) 20 return 21} 22 23// ----- 24func.func @bad_declare(%arg0: !fir.ref<f32>) { 25 // expected-error@+1 {{'hlfir.declare' op second result type must match input memref type}} 26 %0:2 = hlfir.declare %arg0 {uniq_name = "x"} : (!fir.ref<f32>) -> (!fir.ref<i32>, !fir.ref<i32>) 27 return 28} 29 30// ----- 31 32// Test that FortranVariableInterface verifier is kicking in. This verifier itself is already tested with fir.declare. 33func.func @bad_array_declare(%arg0: !fir.ref<!fir.array<?x?xf32>>) { 34 // expected-error@+1 {{'hlfir.declare' op of array entity with a raw address base must have a shape operand that is a shape or shapeshift}} 35 %0:2 = hlfir.declare %arg0 {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>) -> (!fir.box<!fir.array<?x?xf32>>, !fir.ref<!fir.array<?x?xf32>>) 36 return 37} 38 39// ----- 40func.func @bad_assign_scalar_character(%arg0: !fir.boxchar<1>, %arg1: !fir.char<1,?>) { 41 // expected-error@+1 {{'hlfir.assign' op operand #0 must be any Fortran value or variable type, but got '!fir.char<1,?>'}} 42 hlfir.assign %arg1 to %arg0 : !fir.char<1,?>, !fir.boxchar<1> 43 return 44} 45 46// ----- 47func.func @bad_assign_scalar_character_1(%arg0: !fir.boxchar<1>, %arg1: !hlfir.expr<!fir.char<1,?>>) { 48 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!hlfir.expr<!fir.char<1,?>>'}} 49 hlfir.assign %arg0 to %arg1 : !fir.boxchar<1>, !hlfir.expr<!fir.char<1,?>> 50 return 51} 52 53// ----- 54func.func @bad_assign_scalar_integer(%arg0: !fir.ref<i32>, %arg1: i32) { 55 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got 'i32'}} 56 hlfir.assign %arg0 to %arg1 : !fir.ref<i32>, i32 57 return 58} 59 60// ----- 61func.func @bad_assign_array(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<?xi32>) { 62 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!fir.ref<!fir.array<?xi32>>'}} 63 hlfir.assign %arg1 to %arg0 : !hlfir.expr<?xi32>, !fir.ref<!fir.array<?xi32>> 64 return 65} 66 67// ----- 68func.func @bad_assign_array_2(%arg0: !fir.ref<!fir.array<10xi32>>, %arg1: !hlfir.expr<?xi32>) { 69 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!hlfir.expr<?xi32>'}} 70 hlfir.assign %arg0 to %arg1 : !fir.ref<!fir.array<10xi32>>, !hlfir.expr<?xi32> 71 return 72} 73 74// ----- 75func.func @bad_designate_component(%arg0 : !fir.ref<i32>) { 76 // expected-error@+1 {{'hlfir.designate' op component must be provided only when the memref is a derived type}} 77 %0 = hlfir.designate %arg0 {"some_component"} : (!fir.ref<i32>) -> !fir.ref<i32> 78 return 79} 80 81// ----- 82func.func @bad_designate_component_2(%arg0 : !fir.ref<!fir.type<t{i:i32}>>) { 83 // expected-error@+1 {{'hlfir.designate' op component "bad_comp" is not a component of memref element type '!fir.type<t{i:i32}>'}} 84 %0 = hlfir.designate %arg0 {"bad_comp"} : (!fir.ref<!fir.type<t{i:i32}>>) -> !fir.ref<i32> 85 return 86} 87 88// ----- 89func.func @bad_designate_component_3(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) { 90 // expected-error@+1 {{'hlfir.designate' op indices must be provided and must not contain triplets when both memref and component are arrays}} 91 %0 = hlfir.designate %arg0 {"i"} : (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) -> !fir.ref<i32> 92 return 93} 94 95// ----- 96func.func @bad_designate_component_4(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) { 97 %component_shape = fir.undefined !fir.shape<1> 98 %c1 = arith.constant 1 : index 99 // expected-error@+1 {{'hlfir.designate' op indices must be provided and must not contain triplets when both memref and component are arrays}} 100 %0 = hlfir.designate %arg0 {"i"}<%component_shape>(%c1:%c1:%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>, !fir.shape<1>, index, index, index) -> !fir.ref<!fir.array<20xi32>> 101 return 102} 103 104// ----- 105func.func @bad_designate_component_5(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) { 106 %component_shape = fir.undefined !fir.shape<2> 107 %c1 = arith.constant 1 : index 108 // expected-error@+1 {{'hlfir.designate' op component_shape must be a fir.shape or fir.shapeshift with the rank of the component}} 109 %0 = hlfir.designate %arg0 {"i"}<%component_shape>(%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>, !fir.shape<2>, index) -> !fir.ref<!fir.array<20xi32>> 110 return 111} 112 113// ----- 114func.func @bad_designate_component_6(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) { 115 %component_shape = fir.undefined !fir.shift<1> 116 %c1 = arith.constant 1 : index 117 // expected-error@+1 {{'hlfir.designate' op component_shape must be a fir.shape or fir.shapeshift with the rank of the component}} 118 %0 = hlfir.designate %arg0 {"i"}<%component_shape>(%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>, !fir.shift<1>, index) -> !fir.ref<!fir.array<20xi32>> 119 return 120} 121 122// ----- 123func.func @bad_designate_component_7(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) { 124 %component_shape = fir.undefined !fir.shapeshift<2> 125 %c1 = arith.constant 1 : index 126 // expected-error@+1 {{'hlfir.designate' op component_shape must be a fir.shape or fir.shapeshift with the rank of the component}} 127 %0 = hlfir.designate %arg0 {"i"}<%component_shape>(%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>, !fir.shapeshift<2>, index) -> !fir.ref<!fir.array<20xi32>> 128 return 129} 130 131// ----- 132func.func @bad_designate_component_8(%arg0 : !fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>) { 133 %c1 = arith.constant 1 : index 134 // expected-error@+1 {{'hlfir.designate' op component_shape must be provided when indexing a component}} 135 %0 = hlfir.designate %arg0 {"i"}(%c1): (!fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>, index) -> !fir.ref<i32> 136 return 137} 138 139// ----- 140func.func @bad_designate_component_9(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:i32}>>>) { 141 %c1 = arith.constant 1 : index 142 // expected-error@+1 {{'hlfir.designate' op indices must not be provided if component appears and is not an array component}} 143 %0 = hlfir.designate %arg0 {"i"}(%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:i32}>>>, index) -> !fir.ref<i32> 144 return 145} 146 147// ----- 148func.func @bad_designate_component_10(%arg0 : !fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>) { 149 %component_shape = fir.undefined !fir.shapeshift<1> 150 %c1 = arith.constant 1 : index 151 // expected-error@+1 {{'hlfir.designate' op indices number must match array component rank}} 152 %0 = hlfir.designate %arg0 {"i"}<%component_shape>(%c1, %c1): (!fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>, !fir.shapeshift<1>, index, index) -> !fir.ref<i32> 153 return 154} 155 156// ----- 157func.func @bad_designate_substring_1(%arg0 : !fir.ref<!fir.char<1,20>>) { 158 %c1 = arith.constant 1 : index 159 // expected-error@+1 {{'hlfir.designate' op substring must contain 2 indices when provided}} 160 %0 = hlfir.designate %arg0 substr %c1, %c1, %c1: (!fir.ref<!fir.char<1,20>>, index, index, index) -> !fir.boxchar<1> 161 return 162} 163 164// ----- 165func.func @bad_designate_indices_1(%arg0 : !fir.ref<i32>) { 166 %c1 = arith.constant 1 : index 167 // expected-error@+1 {{'hlfir.designate' op indices number must match memref rank}} 168 %0 = hlfir.designate %arg0 (%c1, %c1): (!fir.ref<i32>, index, index) -> !fir.ref<i32> 169 return 170} 171 172// ----- 173func.func @bad_designate_indices_2(%arg0 : !fir.ref<!fir.array<10xi32>>) { 174 %c1 = arith.constant 1 : index 175 // expected-error@+1 {{'hlfir.designate' op indices number must match memref rank}} 176 %0 = hlfir.designate %arg0 (%c1, %c1): (!fir.ref<!fir.array<10xi32>>, index, index) -> !fir.ref<i32> 177 return 178} 179 180// ----- 181func.func @bad_designate_substring_2(%arg0 : !fir.ref<i32>) { 182 %c1 = arith.constant 1 : index 183 // expected-error@+1 {{'hlfir.designate' op memref or component must have character type if substring indices are provided}} 184 %0 = hlfir.designate %arg0 substr %c1, %c1: (!fir.ref<i32>, index, index) -> !fir.boxchar<1> 185 return 186} 187 188// ----- 189func.func @bad_designate_cmplx_part(%arg0 : !fir.ref<!fir.array<10xi32>>) { 190 %c1 = arith.constant 1 : index 191 // expected-error@+1 {{'hlfir.designate' op memref or component must have complex type if complex_part is provided}} 192 %0 = hlfir.designate %arg0 (%c1) imag: (!fir.ref<!fir.array<10xi32>>, index) -> !fir.ref<i32> 193 return 194} 195 196// ----- 197func.func @bad_designate_out_rank(%arg0 : !fir.ref<!fir.array<10xi32>>) { 198 %c1 = arith.constant 1 : index 199 // expected-error@+1 {{'hlfir.designate' op result type rank is not consistent with operands, expected rank 1}} 200 %0 = hlfir.designate %arg0 (%c1:%c1:%c1): (!fir.ref<!fir.array<10xi32>>, index, index, index) -> !fir.ref<i32> 201 return 202} 203 204// ----- 205func.func @bad_designate_out_type(%arg0 : !fir.ref<complex<f32>>) { 206 // expected-error@+1 {{'hlfir.designate' op result element type is not consistent with operands, expected 'f32'}} 207 %0 = hlfir.designate %arg0 imag: (!fir.ref<complex<f32>>) -> !fir.ref<complex<f64>> 208 return 209} 210 211// ----- 212func.func @bad_designate_out_type(%arg0 : !fir.ref<!fir.box<complex<f32>>>) { 213 // expected-error@+1 {{'hlfir.designate' op result type must only be a box address type if it designates a component that is a fir.box or fir.class and if there are no indices, substrings, and complex part}} 214 %0 = hlfir.designate %arg0 imag: (!fir.ref<!fir.box<complex<f32>>>) -> !fir.ref<!fir.box<f32>> 215 return 216} 217 218// ----- 219func.func @bad_designate_shape(%arg0 : !fir.ref<!fir.array<10xi32>>) { 220 %c1 = arith.constant 1 : index 221 // expected-error@+1 {{'hlfir.designate' op shape must be provided if and only if the result is an array that is not a box address}} 222 %0 = hlfir.designate %arg0 (%c1:%c1:%c1): (!fir.ref<!fir.array<10xi32>>, index, index, index) -> !fir.box<!fir.array<?xi32>> 223 return 224} 225 226// ----- 227func.func @bad_designate_shape_2(%arg0 : !fir.ref<!fir.array<10xi32>>) { 228 %c1 = arith.constant 1 : index 229 %shape = fir.undefined !fir.shape<1> 230 // expected-error@+1 {{'hlfir.designate' op shape must be provided if and only if the result is an array that is not a box address}} 231 %0 = hlfir.designate %arg0 (%c1) shape %shape: (!fir.ref<!fir.array<10xi32>>, index, !fir.shape<1>) -> !fir.ref<i32> 232 return 233} 234 235// ----- 236func.func @bad_designate_len_params(%arg0 : !fir.ref<!fir.char<1,10>>) { 237 %c1 = arith.constant 1 : index 238 // expected-error@+1 {{'hlfir.designate' op must be provided one length parameter when the result is a character}} 239 %0 = hlfir.designate %arg0 substr %c1, %c1: (!fir.ref<!fir.char<1,10>>, index, index) -> !fir.boxchar<1> 240 return 241} 242 243// ----- 244func.func @bad_designate_len_params_2(%arg0 : !fir.box<!fir.array<?x!fir.type<pdt(param:i32){field:i32}>>>) { 245 %c1 = arith.constant 1 : index 246 // expected-error@+1 {{'hlfir.designate' op must be provided the same number of length parameters as in the result derived type}} 247 %0 = hlfir.designate %arg0(%c1) typeparams %c1, %c1 : (!fir.box<!fir.array<?x!fir.type<pdt(param:i32){field:i32}>>>, index, index, index) -> !fir.box<!fir.type<pdt(param:i32){field:i32}>> 248 return 249} 250 251// ----- 252func.func @bad_designate_len_params_3(%arg0 : !fir.box<!fir.array<?xi32>>) { 253 %c1 = arith.constant 1 : index 254 // expected-error@+1 {{'hlfir.designate' op must not be provided length parameters if the result type does not have length parameters}} 255 %0 = hlfir.designate %arg0(%c1) typeparams %c1 : (!fir.box<!fir.array<?xi32>>, index, index) -> !fir.ref<i32> 256 return 257} 258 259// ----- 260func.func @bad_concat(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<1,20>>) { 261 %c30 = arith.constant 30 : index 262 // expected-error@+1 {{'hlfir.concat' op result #0 must be any character scalar expression type, but got '!fir.ref<!fir.char<1,30>>'}} 263 %0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<1,20>>, index) -> (!fir.ref<!fir.char<1,30>>) 264 return 265} 266 267// ----- 268func.func @bad_concat_2(%arg0: !fir.ref<!fir.array<100x!fir.char<1,10>>>, %arg1: !fir.ref<!fir.array<100x!fir.char<1,20>>>) { 269 %c30 = arith.constant 30 : index 270 // expected-error@+1 {{'hlfir.concat' op operand #0 must be variadic of any character scalar type, but got '!fir.ref<!fir.array<100x!fir.char<1,10>>>'}} 271 %0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.array<100x!fir.char<1,10>>>, !fir.ref<!fir.array<100x!fir.char<1,20>>>, index) -> (!hlfir.expr<100x!fir.char<1,30>>) 272 return 273} 274 275// ----- 276func.func @bad_concat_3(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<i32>) { 277 %c30 = arith.constant 30 : index 278 // expected-error@+1 {{'hlfir.concat' op operand #1 must be variadic of any character scalar type, but got '!fir.ref<i32>'}} 279 %0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<i32>, index) -> (!hlfir.expr<!fir.char<1,30>>) 280 return 281} 282 283// ----- 284func.func @bad_concat_4(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<2,20>>) { 285 %c30 = arith.constant 30 : index 286 // expected-error@+1 {{'hlfir.concat' op strings must have the same KIND as the result type}} 287 %0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<2,20>>, index) -> (!hlfir.expr<!fir.char<1,30>>) 288 return 289} 290 291// ----- 292func.func @bad_concat_4(%arg0: !fir.ref<!fir.char<1,30>>) { 293 %c30 = arith.constant 30 : index 294 // expected-error@+1 {{'hlfir.concat' op must be provided at least two string operands}} 295 %0 = hlfir.concat %arg0 len %c30 : (!fir.ref<!fir.char<1,30>>, index) -> (!hlfir.expr<!fir.char<1,30>>) 296 return 297} 298 299// ----- 300func.func @bad_any1(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 301 // expected-error@+1 {{'hlfir.any' op result must have the same element type as MASK argument}} 302 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !fir.logical<8> 303} 304 305// ----- 306func.func @bad_any2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) { 307 // expected-error@+1 {{'hlfir.any' op result must have the same element type as MASK argument}} 308 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x!fir.logical<8>> 309} 310 311// ----- 312func.func @bad_any3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){ 313 // expected-error@+1 {{'hlfir.any' op result rank must be one less than MASK}} 314 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>> 315} 316 317// ----- 318func.func @bad_any4(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) { 319 // expected-error@+1 {{'hlfir.any' op result must be an array}} 320 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<!fir.logical<4>> 321} 322 323// ----- 324func.func @bad_any5(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 325 // expected-error@+1 {{'hlfir.any' op result must be of logical type}} 326 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> i32 327} 328 329// ----- 330func.func @bad_any6(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 331 // expected-error@+1 {{'hlfir.any' op result must be of logical type}} 332 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !hlfir.expr<!fir.logical<4>> 333} 334 335// ----- 336func.func @bad_all1(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 337 // expected-error@+1 {{'hlfir.all' op result must have the same element type as MASK argument}} 338 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !fir.logical<8> 339} 340 341// ----- 342func.func @bad_all2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) { 343 // expected-error@+1 {{'hlfir.all' op result must have the same element type as MASK argument}} 344 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x!fir.logical<8>> 345} 346 347// ----- 348func.func @bad_all3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){ 349 // expected-error@+1 {{'hlfir.all' op result rank must be one less than MASK}} 350 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>> 351} 352 353// ----- 354func.func @bad_all4(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) { 355 // expected-error@+1 {{'hlfir.all' op result must be an array}} 356 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<!fir.logical<4>> 357} 358 359// ----- 360func.func @bad_all5(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 361 // expected-error@+1 {{'hlfir.all' op result must be of logical type}} 362 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> i32 363} 364 365// ----- 366func.func @bad_all6(%arg0: !hlfir.expr<?x!fir.logical<4>>) { 367 // expected-error@+1 {{'hlfir.all' op result must be of logical type}} 368 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !hlfir.expr<!fir.logical<4>> 369} 370 371// ----- 372func.func @bad_count1(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) { 373 // expected-error@+1 {{'hlfir.count' op result must be an array}} 374 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<i32> 375} 376 377// ----- 378func.func @bad_count2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){ 379 // expected-error@+1 {{'hlfir.count' op result rank must be one less than MASK}} 380 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>> 381} 382 383// ----- 384func.func @bad_count3(%arg0: !hlfir.expr<?x!fir.logical<4>>, %arg1: i32) { 385 // expected-error@+1 {{'hlfir.count' op result must be of numerical array type}} 386 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x!fir.logical<4>>, i32) -> !hlfir.expr<i32> 387} 388 389// ----- 390func.func @bad_count4(%arg0: !hlfir.expr<?x!fir.logical<4>>, %arg1: i32) { 391 // expected-error@+1 {{'hlfir.count' op result must be of numerical scalar type}} 392 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x!fir.logical<4>>, i32) -> !fir.logical<4> 393} 394 395// ----- 396func.func @bad_maxval1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 397 // expected-error@+1 {{'hlfir.maxval' op result must have the same element type as ARRAY argument}} 398 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 399} 400 401// ----- 402func.func @bad_maxval2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 403 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 404 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 405} 406 407// ----- 408func.func @bad_maxval3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 409 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 410 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 411} 412 413// ----- 414func.func @bad_maxval4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 415 // expected-error@+1 {{'hlfir.maxval' op result rank must be one less than ARRAY}} 416 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 417} 418 419// ----- 420func.func @bad_maxval5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 421 // expected-error@+1 {{'hlfir.maxval' op result must be of numerical scalar type}} 422 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 423} 424 425// ----- 426func.func @bad_maxval6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 427 // expected-error@+1 {{'hlfir.maxval' op result must be an array}} 428 %0 = hlfir.maxval %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 429} 430 431// ----- 432func.func @bad_maxval7(%arg0: !hlfir.expr<?xi32>){ 433 // expected-error@+1 {{'hlfir.maxval' op result must be of numerical scalar type}} 434 %0 = hlfir.maxval %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32> 435} 436 437// ----- 438func.func @bad_maxval8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 439 // expected-error@+1 {{'hlfir.maxval' op result must have the same element type as ARRAY argument}} 440 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> i32 441} 442 443// ----- 444func.func @bad_maxval9(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 445 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 446 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 447} 448 449// ----- 450func.func @bad_maxval10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 451 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 452 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?x!fir.char<1,?>>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 453} 454 455// ----- 456func.func @bad_maxval11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 457 // expected-error@+1 {{'hlfir.maxval' op result rank must be one less than ARRAY}} 458 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?x!fir.char<1,?>> 459} 460 461// ----- 462func.func @bad_maxval12(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 463 // expected-error@+1 {{'hlfir.maxval' op result must be scalar character}} 464 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x!fir.char<1,?>> 465} 466 467// ----- 468func.func @bad_maxval13(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32){ 469 // expected-error@+1 {{'hlfir.maxval' op result must be an array}} 470 %0 = hlfir.maxval %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32) -> !hlfir.expr<!fir.char<1,?>> 471} 472 473// ----- 474func.func @bad_minval1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 475 // expected-error@+1 {{'hlfir.minval' op result must have the same element type as ARRAY argument}} 476 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 477} 478 479// ----- 480func.func @bad_minval2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 481 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 482 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 483} 484 485// ----- 486func.func @bad_minval3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 487 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 488 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 489} 490 491// ----- 492func.func @bad_minval4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 493 // expected-error@+1 {{'hlfir.minval' op result rank must be one less than ARRAY}} 494 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 495} 496 497// ----- 498func.func @bad_minval5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 499 // expected-error@+1 {{'hlfir.minval' op result must be of numerical scalar type}} 500 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 501} 502 503// ----- 504func.func @bad_minval6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 505 // expected-error@+1 {{'hlfir.minval' op result must be an array}} 506 %0 = hlfir.minval %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 507} 508 509// ----- 510func.func @bad_minval7(%arg0: !hlfir.expr<?xi32>){ 511 // expected-error@+1 {{'hlfir.minval' op result must be of numerical scalar type}} 512 %0 = hlfir.minval %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32> 513} 514 515// ----- 516func.func @bad_minval8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 517 // expected-error@+1 {{'hlfir.minval' op result must have the same element type as ARRAY argument}} 518 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> i32 519} 520 521// ----- 522func.func @bad_minval9(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 523 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 524 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 525} 526 527// ----- 528func.func @bad_minval10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 529 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 530 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?x!fir.char<1,?>>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 531} 532 533// ----- 534func.func @bad_minval11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 535 // expected-error@+1 {{'hlfir.minval' op result rank must be one less than ARRAY}} 536 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?x!fir.char<1,?>> 537} 538 539// ----- 540func.func @bad_minval12(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 541 // expected-error@+1 {{'hlfir.minval' op result must be scalar character}} 542 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x!fir.char<1,?>> 543} 544 545// ----- 546func.func @bad_minval13(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32){ 547 // expected-error@+1 {{'hlfir.minval' op result must be an array}} 548 %0 = hlfir.minval %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32) -> !hlfir.expr<!fir.char<1,?>> 549} 550 551// ----- 552func.func @bad_minloc1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 553 // expected-error@+1 {{'hlfir.minloc' op result must be scalar integer}} 554 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 555} 556 557// ----- 558func.func @bad_minloc2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 559 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 560 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 561} 562 563// ----- 564func.func @bad_minloc3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 565 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 566 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 567} 568 569// ----- 570func.func @bad_minloc4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 571 // expected-error@+1 {{'hlfir.minloc' op result rank must be one less than ARRAY}} 572 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 573} 574 575// ----- 576func.func @bad_minloc5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 577 // expected-error@+1 {{'hlfir.minloc' op result must be scalar integer}} 578 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 579} 580 581// ----- 582func.func @bad_minloc6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 583 // expected-error@+1 {{'hlfir.minloc' op result must be an array}} 584 %0 = hlfir.minloc %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 585} 586 587// ----- 588func.func @bad_minloc7(%arg0: !hlfir.expr<?xi32>){ 589 // expected-error@+1 {{'hlfir.minloc' op result must be of numerical expr type}} 590 %0 = hlfir.minloc %arg0 : (!hlfir.expr<?xi32>) -> i32 591} 592 593// ----- 594func.func @bad_minloc8(%arg0: !hlfir.expr<?xi32>){ 595 // expected-error@+1 {{'hlfir.minloc' op result must have integer elements}} 596 %0 = hlfir.minloc %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<?xf32> 597} 598 599// ----- 600func.func @bad_minloc9(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 601 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 602 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 603} 604 605// ----- 606func.func @bad_minloc10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 607 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 608 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?x!fir.char<1,?>>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 609} 610 611// ----- 612func.func @bad_minloc11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 613 // expected-error@+1 {{'hlfir.minloc' op result rank must be one less than ARRAY}} 614 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 615} 616 617// ----- 618func.func @bad_maxloc1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 619 // expected-error@+1 {{'hlfir.maxloc' op result must be scalar integer}} 620 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 621} 622 623// ----- 624func.func @bad_maxloc2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 625 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 626 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 627} 628 629// ----- 630func.func @bad_maxloc3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 631 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 632 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 633} 634 635// ----- 636func.func @bad_maxloc4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 637 // expected-error@+1 {{'hlfir.maxloc' op result rank must be one less than ARRAY}} 638 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 639} 640 641// ----- 642func.func @bad_maxloc5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 643 // expected-error@+1 {{'hlfir.maxloc' op result must be scalar integer}} 644 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 645} 646 647// ----- 648func.func @bad_maxloc6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 649 // expected-error@+1 {{'hlfir.maxloc' op result must be an array}} 650 %0 = hlfir.maxloc %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 651} 652 653// ----- 654func.func @bad_maxloc7(%arg0: !hlfir.expr<?xi32>){ 655 // expected-error@+1 {{'hlfir.maxloc' op result must be of numerical expr type}} 656 %0 = hlfir.maxloc %arg0 : (!hlfir.expr<?xi32>) -> i32 657} 658 659// ----- 660func.func @bad_maxloc8(%arg0: !hlfir.expr<?xi32>){ 661 // expected-error@+1 {{'hlfir.maxloc' op result must have integer elements}} 662 %0 = hlfir.maxloc %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<?xf32> 663} 664 665// ----- 666func.func @bad_maxloc9(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 667 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 668 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 669} 670 671// ----- 672func.func @bad_maxloc10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 673 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 674 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?x!fir.char<1,?>>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<!fir.char<1,?>> 675} 676 677// ----- 678func.func @bad_maxloc11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 679 // expected-error@+1 {{'hlfir.maxloc' op result rank must be one less than ARRAY}} 680 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 681} 682 683 684// ----- 685func.func @bad_product1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 686 // expected-error@+1 {{'hlfir.product' op result must have the same element type as ARRAY argument}} 687 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 688} 689 690// ----- 691func.func @bad_product2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 692 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 693 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 694} 695 696// ----- 697func.func @bad_product3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 698 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 699 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 700} 701 702// ----- 703func.func @bad_product4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 704 // expected-error@+1 {{'hlfir.product' op result rank must be one less than ARRAY}} 705 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 706} 707 708// ----- 709func.func @bad_product5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 710 // expected-error@+1 {{'hlfir.product' op result must be of numerical scalar type}} 711 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 712} 713 714// ----- 715func.func @bad_product6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 716 // expected-error@+1 {{'hlfir.product' op result must be an array}} 717 %0 = hlfir.product %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 718} 719 720// ----- 721func.func @bad_product7(%arg0: !hlfir.expr<?xi32>){ 722 // expected-error@+1 {{'hlfir.product' op result must be of numerical scalar type}} 723 %0 = hlfir.product %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32> 724} 725 726// ----- 727func.func @bad_sum1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 728 // expected-error@+1 {{'hlfir.sum' op result must have the same element type as ARRAY argument}} 729 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32 730} 731 732// ----- 733func.func @bad_sum2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) { 734 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 735 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 736} 737 738// ----- 739func.func @bad_sum3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) { 740 // expected-warning@+1 {{MASK must be conformable to ARRAY}} 741 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x5x?xi32>, i32, !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) -> !hlfir.expr<i32> 742} 743 744// ----- 745func.func @bad_sum4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 746 // expected-error@+1 {{'hlfir.sum' op result rank must be one less than ARRAY}} 747 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32> 748} 749 750// ----- 751func.func @bad_sum5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) { 752 // expected-error@+1 {{'hlfir.sum' op result must be of numerical scalar type}} 753 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4> 754} 755 756// ----- 757func.func @bad_sum6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){ 758 // expected-error@+1 {{'hlfir.sum' op result must be an array}} 759 %0 = hlfir.sum %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32> 760} 761 762// ----- 763func.func @bad_sum7(%arg0: !hlfir.expr<?xi32>){ 764 // expected-error@+1 {{'hlfir.sum' op result must be of numerical scalar type}} 765 %0 = hlfir.sum %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32> 766} 767 768// ----- 769func.func @bad_matmul1(%arg0: !hlfir.expr<?x?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) { 770 // expected-error@+1 {{'hlfir.matmul' op array must have either rank 1 or rank 2}} 771 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32> 772 return 773} 774 775// ----- 776func.func @bad_matmul2(%arg0: !hlfir.expr<?xi32>, %arg1: !hlfir.expr<?xi32>) { 777 // expected-error@+1 {{'hlfir.matmul' op at least one array must have rank 2}} 778 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?x?xi32> 779 return 780} 781 782// ----- 783func.func @bad_matmul3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: !hlfir.expr<?x?xi32>) { 784 // expected-error@+1 {{'hlfir.matmul' op if one array is logical, so should the other be}} 785 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32> 786 return 787} 788 789// ----- 790func.func @bad_matmul4(%arg0: !hlfir.expr<?x2xi32>, %arg1: !hlfir.expr<200x?xi32>) { 791 // expected-error@+1 {{'hlfir.matmul' op the last dimension of LHS should match the first dimension of RHS}} 792 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x2xi32>, !hlfir.expr<200x?xi32>) -> !hlfir.expr<?x?xi32> 793 return 794} 795 796// ----- 797func.func @bad_matmul5(%arg0: !hlfir.expr<?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) { 798 // expected-error@+1 {{'hlfir.matmul' op the result type should be a logical only if the argument types are logical}} 799 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?x!fir.logical<4>> 800 return 801} 802 803// ----- 804func.func @bad_matmul6(%arg0: !hlfir.expr<1x2xi32>, %arg1: !hlfir.expr<2x3xi32>) { 805 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}} 806 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<1x2xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<10x30xi32> 807 return 808} 809 810// ----- 811func.func @bad_matmul7(%arg0: !hlfir.expr<1x2xi32>, %arg1: !hlfir.expr<2xi32>) { 812 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}} 813 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<1x2xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<1x3xi32> 814 return 815} 816 817// ----- 818func.func @bad_matmul8(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x3xi32>) { 819 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}} 820 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<1x3xi32> 821 return 822} 823 824// ----- 825func.func @bad_dot_product1(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x3xi32>) { 826 // expected-error@+1 {{'hlfir.dot_product' op both arrays must have rank 1}} 827 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x3xi32>) -> i32 828 return 829} 830 831// ----- 832func.func @bad_dot_product2(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<3xi32>) { 833 // expected-error@+1 {{'hlfir.dot_product' op both arrays must have the same size}} 834 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<3xi32>) -> i32 835 return 836} 837 838// ----- 839func.func @bad_dot_product3(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x!fir.logical<4>>) { 840 // expected-error@+1 {{'hlfir.dot_product' op if one array is logical, so should the other be}} 841 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x!fir.logical<4>>) -> i32 842 return 843} 844 845// ----- 846func.func @bad_dot_product4(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2xi32>) { 847 // expected-error@+1 {{'hlfir.dot_product' op the result type should be a logical only if the argument types are logical}} 848 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2xi32>) -> !fir.logical<4> 849 return 850} 851 852// ----- 853func.func @bad_dot_product5(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2xi32>) { 854 // expected-error@+1 {{'hlfir.dot_product' op the result must be of scalar numerical or logical type}} 855 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<i32> 856 return 857} 858 859// ----- 860func.func @bad_transpose1(%arg0: !hlfir.expr<2xi32>) { 861 // expected-error@+1 {{'hlfir.transpose' op input and output arrays should have rank 2}} 862 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2xi32>) -> !hlfir.expr<2xi32> 863 return 864} 865 866// ----- 867func.func @bad_transpose2(%arg0: !hlfir.expr<2x3xi32>) { 868 // expected-error@+1 {{'hlfir.transpose' op output shape does not match input array}} 869 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2x3xi32>) -> !hlfir.expr<2x2xi32> 870 return 871} 872 873// ----- 874func.func @bad_transpose3(%arg0: !hlfir.expr<2x3xi32>) { 875 // expected-error@+1 {{'hlfir.transpose' op input and output arrays should have the same element type}} 876 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2x3xi32>) -> !hlfir.expr<3x2xf64> 877 return 878} 879 880// ----- 881func.func @bad_matmultranspose1(%arg0: !hlfir.expr<?x?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) { 882 // expected-error@+1 {{'hlfir.matmul_transpose' op array must have either rank 1 or rank 2}} 883 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32> 884 return 885} 886 887// ----- 888func.func @bad_matmultranspose2(%arg0: !hlfir.expr<?xi32>, %arg1: !hlfir.expr<?xi32>) { 889 // expected-error@+1 {{'hlfir.matmul_transpose' op array must have either rank 1 or rank 2}} 890 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?x?xi32> 891 return 892} 893 894// ----- 895func.func @bad_matmultranspose3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: !hlfir.expr<?x?xi32>) { 896 // expected-error@+1 {{'hlfir.matmul_transpose' op if one array is logical, so should the other be}} 897 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32> 898 return 899} 900 901// ----- 902func.func @bad_matmultranspose5(%arg0: !hlfir.expr<?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) { 903 // expected-error@+1 {{'hlfir.matmul_transpose' op the result type should be a logical only if the argument types are logical}} 904 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?x!fir.logical<4>> 905 return 906} 907 908// ----- 909func.func @bad_matmultranspose6(%arg0: !hlfir.expr<2x1xi32>, %arg1: !hlfir.expr<2x3xi32>) { 910 // expected-error@+1 {{'hlfir.matmul_transpose' op incorrect result shape}} 911 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<2x1xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<10x30xi32> 912 return 913} 914 915// ----- 916func.func @bad_matmultranspose7(%arg0: !hlfir.expr<2x1xi32>, %arg1: !hlfir.expr<2xi32>) { 917 // expected-error@+1 {{'hlfir.matmul_transpose' op incorrect result shape}} 918 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<2x1xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<1x3xi32> 919 return 920} 921 922// ----- 923func.func @bad_assign_1(%arg0: !fir.box<!fir.array<?xi32>>, %arg1: !fir.box<!fir.array<?xi32>>) { 924 // expected-error@+1 {{'hlfir.assign' op lhs must be an allocatable when `realloc` is set}} 925 hlfir.assign %arg1 to %arg0 realloc : !fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>> 926 return 927} 928 929// ----- 930func.func @bad_assign_2(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %arg1: !fir.box<!fir.array<?xi32>>) { 931 // expected-error@+1 {{'hlfir.assign' op `realloc` must be set and lhs must be a character allocatable when `keep_lhs_length_if_realloc` is set}} 932 hlfir.assign %arg1 to %arg0 realloc keep_lhs_len : !fir.box<!fir.array<?xi32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>> 933 return 934} 935 936// ----- 937func.func @bad_parent_comp1(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) { 938 // expected-error@+1 {{'hlfir.parent_comp' op must be provided a shape if and only if the base is an array}} 939 %2 = hlfir.parent_comp %arg0 : (!fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) -> !fir.box<!fir.array<10x!fir.type<t1{i:i32}>>> 940 return 941} 942 943// ----- 944func.func @bad_parent_comp2(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) { 945 %c10 = arith.constant 10 : index 946 %1 = fir.shape %c10 : (index) -> !fir.shape<1> 947 // expected-error@+1 {{'hlfir.parent_comp' op result type rank must match input type rank}} 948 %2 = hlfir.parent_comp %arg0 shape %1 : (!fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>, !fir.shape<1>) -> !fir.box<!fir.array<2x5x!fir.type<t1{i:i32}>>> 949 return 950} 951 952// ----- 953func.func @bad_parent_comp3(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) { 954 %c10 = arith.constant 10 : index 955 %1 = fir.shape %c10 : (index) -> !fir.shape<1> 956 // expected-error@+1 {{'hlfir.parent_comp' op result type extents are inconsistent with memref type}} 957 %2 = hlfir.parent_comp %arg0 shape %1 : (!fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>, !fir.shape<1>) -> !fir.box<!fir.array<20x!fir.type<t1{i:i32}>>> 958 return 959} 960 961// ----- 962func.func @bad_parent_comp4(%arg0: !fir.ref<!fir.type<t2{i:i32,j:i32}>>) { 963 // expected-error@+1 {{'hlfir.parent_comp' op result type and input type must be derived types}} 964 %1 = hlfir.parent_comp %arg0 : (!fir.ref<!fir.type<t2{i:i32,j:i32}>>) -> !fir.ref<i32> 965 return 966} 967 968// ----- 969func.func @bad_parent_comp5(%arg0: !fir.class<!fir.type<t2{i:i32,j:i32}>>) { 970 // expected-error@+1 {{'hlfir.parent_comp' op result type must not be polymorphic}} 971 %2 = hlfir.parent_comp %arg0 : (!fir.class<!fir.type<t2{i:i32,j:i32}>>) -> !fir.class<!fir.type<t1{i:i32}>> 972 return 973} 974 975// ----- 976func.func @bad_parent_comp6(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) { 977 %c10 = arith.constant 10 : index 978 %1 = fir.shape %c10 : (index) -> !fir.shape<1> 979 // expected-error@+1 {{'hlfir.parent_comp' op result type must be a fir.box if the result is an array or has length parameters}} 980 %2 = hlfir.parent_comp %arg0 shape %1 : (!fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>, !fir.shape<1>) -> !fir.ref<!fir.array<10x!fir.type<t1{i:i32}>>> 981 return 982} 983 984// ----- 985func.func @bad_shapeof(%arg0: !hlfir.expr<!fir.char<1,10>>) { 986 // expected-error@+1 {{'hlfir.shape_of' op cannot get the shape of a shape-less expression}} 987 %0 = hlfir.shape_of %arg0 : (!hlfir.expr<!fir.char<1,10>>) -> !fir.shape<1> 988} 989 990// ----- 991func.func @bad_shapeof2(%arg0: !hlfir.expr<10xi32>) { 992 // expected-error@+1 {{'hlfir.shape_of' op result rank and expr rank do not match}} 993 %0 = hlfir.shape_of %arg0 : (!hlfir.expr<10xi32>) -> !fir.shape<42> 994} 995 996// ----- 997func.func @bad_getextent(%arg0: !fir.shape<1>) { 998 // expected-error@+1 {{'hlfir.get_extent' op dimension index out of bounds}} 999 %0 = hlfir.get_extent %arg0 {dim = 1 : index} : (!fir.shape<1>) -> index 1000} 1001 1002// ----- 1003func.func @bad_region_assign_1(%x: !fir.box<!fir.array<?xf32>>) { 1004// expected-error@+1 {{'hlfir.region_assign' op right-hand side region must be terminated by an hlfir.yield}} 1005 hlfir.region_assign { 1006 %c100 = arith.constant 100 : index 1007 } to { 1008 hlfir.yield %x : !fir.box<!fir.array<?xf32>> 1009 } 1010 return 1011} 1012 1013// ----- 1014func.func @bad_region_assign_2(%x: !fir.box<!fir.array<?xf32>>) { 1015// expected-error@+1 {{'hlfir.region_assign' op left-hand side region must be terminated by an hlfir.yield or hlfir.elemental_addr}} 1016 hlfir.region_assign { 1017 hlfir.yield %x : !fir.box<!fir.array<?xf32>> 1018 } to { 1019 %c100 = arith.constant 100 : index 1020 } user_defined_assign (%rhs: !fir.ref<i64>) to (%lhs: !fir.ref<f32>) { 1021 } 1022 return 1023} 1024 1025// ----- 1026func.func @bad_element_addr_1(%x: !fir.ref<!fir.array<20xf32>>) { 1027 %c20 = arith.constant 20 : index 1028 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1> 1029 hlfir.region_assign { 1030 hlfir.yield %x : !fir.ref<!fir.array<20xf32>> 1031 } to { 1032 // expected-error@+1 {{'hlfir.elemental_addr' op body must compute the address of a scalar entity}} 1033 hlfir.elemental_addr %vector_shape : !fir.shape<1> { 1034 ^bb0(%i: index): 1035 %c42 = arith.constant 42.0 : f32 1036 hlfir.yield %c42 : f32 1037 } 1038 } 1039 return 1040} 1041 1042// ----- 1043func.func @bad_element_addr_2(%x: !fir.ref<!fir.array<20xf32>>) { 1044 %c20 = arith.constant 20 : index 1045 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1> 1046 hlfir.region_assign { 1047 hlfir.yield %x : !fir.ref<!fir.array<20xf32>> 1048 } to { 1049 // expected-error@+1 {{'hlfir.elemental_addr' op body must compute the address of a scalar entity}} 1050 hlfir.elemental_addr %vector_shape : !fir.shape<1> { 1051 ^bb0(%i: index): 1052 hlfir.yield %x : !fir.ref<!fir.array<20xf32>> 1053 } 1054 } 1055 return 1056} 1057 1058// ----- 1059func.func @bad_element_addr_3(%x: !fir.ref<!fir.array<20xf32>>) { 1060 %c20 = arith.constant 20 : index 1061 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1> 1062 hlfir.region_assign { 1063 hlfir.yield %x : !fir.ref<!fir.array<20xf32>> 1064 } to { 1065 // expected-error@+1 {{'hlfir.elemental_addr' op body region must be terminated by an hlfir.yield}} 1066 hlfir.elemental_addr %vector_shape : !fir.shape<1> { 1067 ^bb0(%i: index): 1068 %c42 = arith.constant 42.0 : f32 1069 } 1070 } 1071 return 1072} 1073 1074// ----- 1075func.func @bad_element_addr_4(%x: !fir.ref<!fir.array<20xf32>>, %y: !fir.ref<!fir.array<20x20xf32>>) { 1076 %c20 = arith.constant 20 : index 1077 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1> 1078 hlfir.region_assign { 1079 hlfir.yield %x : !fir.ref<!fir.array<20xf32>> 1080 } to { 1081 // expected-error@+1 {{'hlfir.elemental_addr' op body number of indices must match shape rank}} 1082 hlfir.elemental_addr %vector_shape : !fir.shape<1> { 1083 ^bb0(%i: index, %j: index): 1084 %elt = hlfir.designate %y(%i, %j) : (!fir.ref<!fir.array<20x20xf32>>, index, index) -> !fir.ref<f32> 1085 hlfir.yield %elt : !fir.ref<f32> 1086 } 1087 } 1088 return 1089} 1090 1091// ----- 1092func.func @bad_forall(%x : !fir.box<!fir.array<10xf32>>, %y: f32, %bad : !fir.ref<!fir.array<10xindex>>) { 1093 // expected-error@+1 {{'hlfir.forall' op region #0 ('lb_region') failed to verify constraint: single block region that yields an integer scalar value}} 1094 hlfir.forall lb { 1095 hlfir.yield %bad : !fir.ref<!fir.array<10xindex>> 1096 } ub { 1097 %c10 = arith.constant 10 : index 1098 hlfir.yield %c10 : index 1099 } (%i : index) { 1100 hlfir.region_assign { 1101 hlfir.yield %y : f32 1102 } to { 1103 %xi = hlfir.designate %x(%i) : (!fir.box<!fir.array<10xf32>>, index) -> !fir.ref<f32> 1104 hlfir.yield %xi : !fir.ref<f32> 1105 } 1106 } 1107 return 1108} 1109 1110// ----- 1111func.func @bad_forall_2(%x : !fir.box<!fir.array<10xf32>>, %y: f32) { 1112 // expected-error@+1 {{'hlfir.forall' op body region must only contain OrderedAssignmentTreeOpInterface operations or fir.end}} 1113 hlfir.forall lb { 1114 %c1 = arith.constant 1 : index 1115 hlfir.yield %c1 : index 1116 } ub { 1117 %c10 = arith.constant 10 : index 1118 hlfir.yield %c10 : index 1119 } (%i : index) { 1120 %xi = hlfir.designate %x(%i) : (!fir.box<!fir.array<10xf32>>, index) -> !fir.ref<f32> 1121 hlfir.assign %y to %xi : f32, !fir.ref<f32> 1122 } 1123 return 1124} 1125 1126// ----- 1127func.func @bad_forall_mask(%i: index) { 1128 // expected-error@+1 {{'hlfir.forall_mask' op must be inside the body region of an hlfir.forall}} 1129 hlfir.forall_mask { 1130 %mask = fir.call @some_condition(%i) : (index) -> i1 1131 hlfir.yield %mask : i1 1132 } do { 1133 } 1134 return 1135} 1136 1137// ----- 1138func.func @bad_forall_mask_2(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>) { 1139 %c1 = arith.constant 1 : index 1140 hlfir.forall lb { 1141 hlfir.yield %c1 : index 1142 } ub { 1143 hlfir.yield %c1 : index 1144 } (%i: index) { 1145 // expected-error@+1 {{'hlfir.forall_mask' op mask region must yield a scalar i1}} 1146 hlfir.forall_mask { 1147 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1148 } do { 1149 } 1150 } 1151 return 1152} 1153 1154// ----- 1155func.func @bad_where_1(%bad_mask: !fir.ref<!fir.array<10xf32>>) { 1156 // expected-error@+1 {{'hlfir.where' op mask region must yield a logical array}} 1157 hlfir.where { 1158 hlfir.yield %bad_mask : !fir.ref<!fir.array<10xf32>> 1159 } do { 1160 } 1161 return 1162} 1163 1164// ----- 1165func.func @bad_where_2(%bad_mask: i1) { 1166 // expected-error@+1 {{'hlfir.where' op mask region must yield a logical array}} 1167 hlfir.where { 1168 hlfir.yield %bad_mask : i1 1169 } do { 1170 } 1171 return 1172} 1173 1174// ----- 1175func.func @bad_where_3(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>, %n: index) { 1176 // expected-error@+1 {{'hlfir.where' op body region must not contain hlfir.forall}} 1177 hlfir.where { 1178 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1179 } do { 1180 hlfir.forall lb { 1181 hlfir.yield %n : index 1182 } ub { 1183 hlfir.yield %n : index 1184 } (%i: index) { 1185 } 1186 } 1187 return 1188} 1189 1190// ----- 1191func.func @bad_elsewhere_1(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>, %bad_mask: i1) { 1192 hlfir.where { 1193 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1194 } do { 1195 // expected-error@+1 {{'hlfir.elsewhere' op mask region must yield a logical array when provided}} 1196 hlfir.elsewhere mask { 1197 hlfir.yield %bad_mask : i1 1198 } do { 1199 } 1200 } 1201 return 1202} 1203 1204// ----- 1205func.func @bad_elsewhere_2(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>) { 1206 // expected-error@+1 {{'hlfir.elsewhere' op expects parent op to be one of 'hlfir.where, hlfir.elsewhere'}} 1207 hlfir.elsewhere mask { 1208 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1209 } do { 1210 } 1211 return 1212} 1213 1214// ----- 1215func.func @bad_elsewhere_3(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>, %x: !fir.ref<!fir.array<10xf32>>, %y: !fir.box<!fir.array<?xf32>>) { 1216 hlfir.where { 1217 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1218 } do { 1219 // expected-error@+1 {{'hlfir.elsewhere' op must be the last operation in the parent block}} 1220 hlfir.elsewhere mask { 1221 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>> 1222 } do { 1223 } 1224 hlfir.region_assign { 1225 hlfir.yield %y : !fir.box<!fir.array<?xf32>> 1226 } to { 1227 hlfir.yield %x : !fir.ref<!fir.array<10xf32>> 1228 } 1229 } 1230 return 1231} 1232 1233// ----- 1234func.func @bad_get_length_1(%arg0: !hlfir.expr<i32>) { 1235 // expected-error@+1 {{'hlfir.get_length' op operand #0 must be any character scalar or array expression type, but got '!hlfir.expr<i32>'}} 1236 %1 = hlfir.get_length %arg0 : (!hlfir.expr<i32>) -> index 1237 return 1238} 1239 1240// ----- 1241func.func @bad_get_length_2(%arg0: !hlfir.expr<?xi32>) { 1242 // expected-error@+1 {{'hlfir.get_length' op operand #0 must be any character scalar or array expression type, but got '!hlfir.expr<?xi32>'}} 1243 %1 = hlfir.get_length %arg0 : (!hlfir.expr<?xi32>) -> index 1244 return 1245} 1246 1247// ----- 1248func.func @bad_get_length_3(%arg0: !hlfir.expr<!fir.boxchar<1>>) { 1249 // expected-error@+1 {{'hlfir.get_length' op operand #0 must be any character scalar or array expression type, but got '!hlfir.expr<!fir.boxchar<1>>'}} 1250 %1 = hlfir.get_length %arg0 : (!hlfir.expr<!fir.boxchar<1>>) -> index 1251 return 1252} 1253 1254// ----- 1255func.func @elemental_poly_1(%arg0: !fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>, %shape : index) { 1256 %3 = fir.shape %shape : (index) -> !fir.shape<1> 1257 // expected-error@+1 {{'hlfir.elemental' op operand #1 must be any polymorphic object, but got '!fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>'}} 1258 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> { 1259 ^bb0(%arg2: index): 1260 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?> 1261 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?> 1262 } 1263 return 1264} 1265 1266// ----- 1267func.func @elemental_poly_2(%arg0: !hlfir.expr<?x!fir.type<_QMtypesTt>>, %shape : index) { 1268 %3 = fir.shape %shape : (index) -> !fir.shape<1> 1269 // expected-error@+1 {{'hlfir.elemental' op operand #1 must be any polymorphic object, but got '!hlfir.expr<?x!fir.type<_QMtypesTt>>'}} 1270 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !hlfir.expr<?x!fir.type<_QMtypesTt>>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> { 1271 ^bb0(%arg2: index): 1272 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?> 1273 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?> 1274 } 1275 return 1276} 1277 1278// ----- 1279func.func @elemental_poly_3(%arg0: !hlfir.expr<?x!fir.type<_QMtypesTt>?>, %shape : index) { 1280 %3 = fir.shape %shape : (index) -> !fir.shape<1> 1281// expected-error@+1 {{'hlfir.elemental' op result must be polymorphic when mold is present and vice versa}} 1282 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !hlfir.expr<?x!fir.type<_QMtypesTt>?>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>> { 1283 ^bb0(%arg2: index): 1284 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>> 1285 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>> 1286 } 1287 return 1288} 1289 1290// ----- 1291func.func @elemental_poly_4(%shape : index) { 1292 %3 = fir.shape %shape : (index) -> !fir.shape<1> 1293// expected-error@+1 {{'hlfir.elemental' op result must be polymorphic when mold is present and vice versa}} 1294 %4 = hlfir.elemental %3 unordered : (!fir.shape<1>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> { 1295 ^bb0(%arg2: index): 1296 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?> 1297 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?> 1298 } 1299 return 1300} 1301 1302// ----- 1303func.func @destroy_with_finalize(%expr: !hlfir.expr<?xi32>) { 1304// expected-error@+1 {{'hlfir.destroy' op the element type must be finalizable, when 'finalize' is set}} 1305 hlfir.destroy %expr finalize : !hlfir.expr<?xi32> 1306 return 1307} 1308 1309// ----- 1310 1311func.func @end_associate_with_alloc_comp(%var: !hlfir.expr<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>, %shape: !fir.shape<1>) { 1312 %4:3 = hlfir.associate %var(%shape) {uniq_name = "adapt.valuebyref"} : (!hlfir.expr<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>, !fir.shape<1>) -> (!fir.box<!fir.array<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>, !fir.ref<!fir.array<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>, i1) 1313// expected-error@+1 {{'hlfir.end_associate' op that requires components deallocation must have var operand that is a Fortran entity}} 1314 hlfir.end_associate %4#1, %4#2 : !fir.ref<!fir.array<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>, i1 1315 return 1316} 1317 1318// ----- 1319 1320func.func @bad_eval_in_mem_1() { 1321 %c10 = arith.constant 10 : index 1322 %1 = fir.shape %c10 : (index) -> !fir.shape<1> 1323// expected-error@+1 {{'hlfir.eval_in_mem' op result #0 must be The type of an array, character, or derived type Fortran expression, but got '!fir.array<10xf32>'}} 1324 %2 = hlfir.eval_in_mem shape %1 : (!fir.shape<1>) -> !fir.array<10xf32> { 1325 ^bb0(%arg0: !fir.ref<!fir.array<10xf32>>): 1326 } 1327 return 1328} 1329 1330// ----- 1331 1332func.func @bad_eval_in_mem_2() { 1333 %c10 = arith.constant 10 : index 1334 %1 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2> 1335 // expected-error@+1 {{'hlfir.eval_in_mem' op `shape` rank must match the result rank}} 1336 %2 = hlfir.eval_in_mem shape %1 : (!fir.shape<2>) -> !hlfir.expr<10xf32> { 1337 ^bb0(%arg0: !fir.ref<!fir.array<10xf32>>): 1338 } 1339 return 1340} 1341 1342// ----- 1343 1344func.func @bad_eval_in_mem_3() { 1345 // expected-error@+1 {{'hlfir.eval_in_mem' op must be provided one length parameter when the result is a character}} 1346 %1 = hlfir.eval_in_mem : () -> !hlfir.expr<!fir.char<1,?>> { 1347 ^bb0(%arg0: !fir.ref<!fir.char<1,?>>): 1348 } 1349 return 1350} 1351 1352// ----- 1353 1354func.func @bad_cshift1(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) { 1355 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}} 1356 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?x?xf32> 1357 return 1358} 1359 1360// ----- 1361 1362func.func @bad_cshift2(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) { 1363 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same rank}} 1364 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?xi32> 1365 return 1366} 1367 1368// ----- 1369 1370func.func @bad_cshift3(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) { 1371 // expected-error@+1 {{'hlfir.cshift' op output array's shape conflicts with the input array's shape}} 1372 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, i32) -> !hlfir.expr<2x3xi32> 1373 return 1374} 1375 1376// ----- 1377 1378func.func @bad_cshift4(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) { 1379 %c0 = arith.constant 0 : index 1380 // expected-error@+1 {{'hlfir.cshift' op DIM must be >= 1}} 1381 %0 = hlfir.cshift %arg0 %arg1 dim %c0 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32> 1382 return 1383} 1384 1385// ----- 1386 1387func.func @bad_cshift5(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) { 1388 %c10 = arith.constant 10 : index 1389 // expected-error@+1 {{'hlfir.cshift' op DIM must be <= input array's rank}} 1390 %0 = hlfir.cshift %arg0 %arg1 dim %c10 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32> 1391 return 1392} 1393 1394// ----- 1395 1396func.func @bad_cshift6(%arg0: !hlfir.expr<2x2xi32>, %arg1: !hlfir.expr<2x2xi32>) { 1397 // expected-error@+1 {{'hlfir.cshift' op SHIFT's rank must be 1 less than the input array's rank}} 1398 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, !hlfir.expr<2x2xi32>) -> !hlfir.expr<2x2xi32> 1399 return 1400} 1401 1402// ----- 1403 1404func.func @bad_cshift7(%arg0: !hlfir.expr<?x2xi32>, %arg1: !hlfir.expr<3xi32>) { 1405 %c1 = arith.constant 1 : index 1406 // expected-error@+1 {{'hlfir.cshift' op SHAPE(ARRAY)(2) must be equal to SHAPE(SHIFT)(1): 2 != 3}} 1407 %0 = hlfir.cshift %arg0 %arg1 dim %c1 : (!hlfir.expr<?x2xi32>, !hlfir.expr<3xi32>, index) -> !hlfir.expr<2x2xi32> 1408 return 1409} 1410 1411// ----- 1412 1413func.func @bad_cshift8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32) { 1414 // expected-error@+2 {{'hlfir.cshift' op character KIND mismatch}} 1415 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}} 1416 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,?>>, i32) -> !hlfir.expr<?x!fir.char<2,?>> 1417 return 1418} 1419 1420// ----- 1421 1422func.func @bad_cshift9(%arg0: !hlfir.expr<?x!fir.char<1,1>>, %arg1: i32) { 1423 // expected-error@+2 {{'hlfir.cshift' op character LEN mismatch}} 1424 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}} 1425 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,1>>, i32) -> !hlfir.expr<?x!fir.char<1,2>> 1426 return 1427} 1428 1429// ----- 1430 1431func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>) { 1432 // expected-error@+1 {{'hlfir.reshape' op ARRAY and the result must have the same element type}} 1433 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>) -> !hlfir.expr<?xf32> 1434 return 1435} 1436 1437// ----- 1438 1439func.func @bad_reshape(%arg0: !hlfir.expr<?x!fir.type<whatever>?>, %arg1: !hlfir.expr<1xi32>) { 1440 // expected-error@+1 {{'hlfir.reshape' op ARRAY must be polymorphic iff result is polymorphic}} 1441 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<?x!fir.type<whatever>?>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.type<whatever>> 1442 return 1443} 1444 1445// ----- 1446 1447func.func @bad_reshape(%arg0: !hlfir.expr<?x!fir.type<whatever>>, %arg1: !hlfir.expr<1xi32>) { 1448 // expected-error@+1 {{'hlfir.reshape' op ARRAY must be polymorphic iff result is polymorphic}} 1449 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<?x!fir.type<whatever>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.type<whatever>?> 1450 return 1451} 1452 1453// ----- 1454 1455func.func @bad_reshape(%arg0: !hlfir.expr<1x1xi32>) { 1456 // expected-error@+1 {{'hlfir.reshape' op SHAPE must be an array of rank 1}} 1457 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1x1xi32>, !hlfir.expr<1x1xi32>) -> !hlfir.expr<?xi32> 1458 return 1459} 1460 1461// ----- 1462 1463func.func @bad_reshape(%arg0: !hlfir.expr<1xf32>) { 1464 // expected-error@+1 {{'hlfir.reshape' op SHAPE must be an integer array}} 1465 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xf32>, !hlfir.expr<1xf32>) -> !hlfir.expr<?xf32> 1466 return 1467} 1468 1469// ----- 1470 1471func.func @bad_reshape(%arg0: !hlfir.expr<?xi32>) { 1472 // expected-error@+1 {{'hlfir.reshape' op SHAPE must have known size}} 1473 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?xi32> 1474 return 1475} 1476 1477// ----- 1478 1479func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>) { 1480 // expected-error@+1 {{'hlfir.reshape' op SHAPE's extent must match the result rank}} 1481 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x?xi32> 1482 return 1483} 1484 1485// ----- 1486 1487func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?xi16>) { 1488 // expected-error@+1 {{'hlfir.reshape' op ARRAY and PAD must be of the same type}} 1489 %0 = hlfir.reshape %arg0 %arg0 pad %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?xi16>) -> !hlfir.expr<?xi32> 1490 return 1491} 1492 1493// ----- 1494 1495func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?x?xi16>) { 1496 // expected-error@+1 {{'hlfir.reshape' op ORDER must be an array of rank 1}} 1497 %0 = hlfir.reshape %arg0 %arg0 order %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?x?xi16>) -> !hlfir.expr<?xi32> 1498 return 1499} 1500 1501// ----- 1502 1503func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?xf16>) { 1504 // expected-error@+1 {{'hlfir.reshape' op ORDER must be an integer array}} 1505 %0 = hlfir.reshape %arg0 %arg0 order %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?xf16>) -> !hlfir.expr<?xi32> 1506 return 1507} 1508 1509// ----- 1510 1511func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) { 1512 // expected-error@+1 {{'hlfir.reshape' op operand #0 must be any array-like entity}} 1513 %0 = hlfir.reshape %arg0 %arg1 : (!fir.ref<!fir.array<?xi32>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?xi32> 1514 return 1515} 1516 1517// ----- 1518 1519func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<?xi32>) { 1520 // expected-error@+1 {{'hlfir.reshape' op operand #1 must be any array-like entity containing a numerical type}} 1521 %0 = hlfir.reshape %arg1 %arg0 : (!hlfir.expr<?xi32>, !fir.ref<!fir.array<?xi32>>) -> !hlfir.expr<?xi32> 1522 return 1523} 1524 1525// ----- 1526 1527func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) { 1528 // expected-error@+1 {{'hlfir.reshape' op operand #2 must be any array-like entity}} 1529 %0 = hlfir.reshape %arg1 %arg1 pad %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !fir.ref<!fir.array<?xi32>>) -> !hlfir.expr<?xi32> 1530 return 1531} 1532 1533// ----- 1534 1535func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) { 1536 // expected-error@+1 {{'hlfir.reshape' op operand #3 must be any array-like entity containing a numerical type}} 1537 %0 = hlfir.reshape %arg1 %arg1 pad %arg1 order %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !fir.ref<!fir.array<?xi32>>) -> !hlfir.expr<?xi32> 1538 return 1539} 1540 1541// ----- 1542 1543func.func @bad_reshape(%arg0: !hlfir.expr<1x!fir.char<1,2>>, %arg1: !hlfir.expr<1xi32>) { 1544 // expected-error@+2 {{'hlfir.reshape' op character KIND mismatch}} 1545 // expected-error@+1 {{'hlfir.reshape' op ARRAY and the result must have the same element type}} 1546 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<1x!fir.char<1,2>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.char<2,?>> 1547 return 1548} 1549 1550// ----- 1551 1552func.func @bad_reshape(%arg0: !hlfir.expr<1x!fir.char<1,2>>, %arg1: !hlfir.expr<1xi32>, %arg2: !hlfir.expr<1x!fir.char<2,?>>) { 1553 // expected-error@+2 {{'hlfir.reshape' op character KIND mismatch}} 1554 // expected-error@+1 {{'hlfir.reshape' op ARRAY and PAD must be of the same type}} 1555 %0 = hlfir.reshape %arg0 %arg1 pad %arg2 : (!hlfir.expr<1x!fir.char<1,2>>, !hlfir.expr<1xi32>, !hlfir.expr<1x!fir.char<2,?>>) -> !hlfir.expr<?x!fir.char<1,?>> 1556 return 1557} 1558