1702 lines · plain
1// HLFIR ops diagnotic tests2 3// RUN: fir-opt -strict-intrinsic-verifier -split-input-file -verify-diagnostics %s4 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 return9}10 11// -----12func.func @bad_declare_lower_bounds(%arg0: !fir.ref<!fir.array<2x4xf32>>) {13 %c1 = arith.constant 1 : index14 %c2 = arith.constant 2 : index15 %c3 = arith.constant 3 : index16 %c4 = arith.constant 4 : index17 %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 return21}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 return28}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 return37}38 39// -----40func.func @bad_declare_skip_rebox(%arg0: !fir.ref<f32>) {41 // expected-error@+1 {{'hlfir.declare' op skip_rebox attribute must only be set when the input is a box}}42 %0:2 = hlfir.declare %arg0 skip_rebox {uniq_name = "x"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)43 return44}45 46// -----47 48// -----49func.func @bad_assign_scalar_character(%arg0: !fir.boxchar<1>, %arg1: !fir.char<1,?>) {50 // expected-error@+1 {{'hlfir.assign' op operand #0 must be any Fortran value or variable type, but got '!fir.char<1,?>'}}51 hlfir.assign %arg1 to %arg0 : !fir.char<1,?>, !fir.boxchar<1>52 return53}54 55// -----56func.func @bad_assign_scalar_character_1(%arg0: !fir.boxchar<1>, %arg1: !hlfir.expr<!fir.char<1,?>>) {57 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!hlfir.expr<!fir.char<1,?>>'}}58 hlfir.assign %arg0 to %arg1 : !fir.boxchar<1>, !hlfir.expr<!fir.char<1,?>>59 return60}61 62// -----63func.func @bad_assign_scalar_integer(%arg0: !fir.ref<i32>, %arg1: i32) {64 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got 'i32'}}65 hlfir.assign %arg0 to %arg1 : !fir.ref<i32>, i3266 return67}68 69// -----70func.func @bad_assign_array(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<?xi32>) {71 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!fir.ref<!fir.array<?xi32>>'}}72 hlfir.assign %arg1 to %arg0 : !hlfir.expr<?xi32>, !fir.ref<!fir.array<?xi32>>73 return74}75 76// -----77func.func @bad_assign_array_2(%arg0: !fir.ref<!fir.array<10xi32>>, %arg1: !hlfir.expr<?xi32>) {78 // expected-error@+1 {{'hlfir.assign' op operand #1 must be any HLFIR variable type, but got '!hlfir.expr<?xi32>'}}79 hlfir.assign %arg0 to %arg1 : !fir.ref<!fir.array<10xi32>>, !hlfir.expr<?xi32>80 return81}82 83// -----84func.func @bad_designate_component(%arg0 : !fir.ref<i32>) {85 // expected-error@+1 {{'hlfir.designate' op component must be provided only when the memref is a derived type}}86 %0 = hlfir.designate %arg0 {"some_component"} : (!fir.ref<i32>) -> !fir.ref<i32>87 return88}89 90// -----91func.func @bad_designate_component_2(%arg0 : !fir.ref<!fir.type<t{i:i32}>>) {92 // expected-error@+1 {{'hlfir.designate' op component "bad_comp" is not a component of memref element type '!fir.type<t{i:i32}>'}}93 %0 = hlfir.designate %arg0 {"bad_comp"} : (!fir.ref<!fir.type<t{i:i32}>>) -> !fir.ref<i32>94 return95}96 97// -----98func.func @bad_designate_component_3(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) {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"} : (!fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) -> !fir.ref<i32>101 return102}103 104// -----105func.func @bad_designate_component_4(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) {106 %component_shape = fir.undefined !fir.shape<1>107 %c1 = arith.constant 1 : index108 // expected-error@+1 {{'hlfir.designate' op indices must be provided and must not contain triplets when both memref and component are arrays}}109 %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>>110 return111}112 113// -----114func.func @bad_designate_component_5(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) {115 %component_shape = fir.undefined !fir.shape<2>116 %c1 = arith.constant 1 : index117 // 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.shape<2>, index) -> !fir.ref<!fir.array<20xi32>>119 return120}121 122// -----123func.func @bad_designate_component_6(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) {124 %component_shape = fir.undefined !fir.shift<1>125 %c1 = arith.constant 1 : index126 // 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.shift<1>, index) -> !fir.ref<!fir.array<20xi32>>128 return129}130 131// -----132func.func @bad_designate_component_7(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:!fir.array<100xi32>}>>>) {133 %component_shape = fir.undefined !fir.shapeshift<2>134 %c1 = arith.constant 1 : index135 // expected-error@+1 {{'hlfir.designate' op component_shape must be a fir.shape or fir.shapeshift with the rank of the component}}136 %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>>137 return138}139 140// -----141func.func @bad_designate_component_8(%arg0 : !fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>) {142 %c1 = arith.constant 1 : index143 // expected-error@+1 {{'hlfir.designate' op component_shape must be provided when indexing a component}}144 %0 = hlfir.designate %arg0 {"i"}(%c1): (!fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>, index) -> !fir.ref<i32>145 return146}147 148// -----149func.func @bad_designate_component_9(%arg0 : !fir.ref<!fir.array<20x!fir.type<t{i:i32}>>>) {150 %c1 = arith.constant 1 : index151 // expected-error@+1 {{'hlfir.designate' op indices must not be provided if component appears and is not an array component}}152 %0 = hlfir.designate %arg0 {"i"}(%c1): (!fir.ref<!fir.array<20x!fir.type<t{i:i32}>>>, index) -> !fir.ref<i32>153 return154}155 156// -----157func.func @bad_designate_component_10(%arg0 : !fir.ref<!fir.type<t{i:!fir.array<100xi32>}>>) {158 %component_shape = fir.undefined !fir.shapeshift<1>159 %c1 = arith.constant 1 : index160 // expected-error@+1 {{'hlfir.designate' op indices number must match array component rank}}161 %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>162 return163}164 165// -----166func.func @bad_designate_substring_1(%arg0 : !fir.ref<!fir.char<1,20>>) {167 %c1 = arith.constant 1 : index168 // expected-error@+1 {{'hlfir.designate' op substring must contain 2 indices when provided}}169 %0 = hlfir.designate %arg0 substr %c1, %c1, %c1: (!fir.ref<!fir.char<1,20>>, index, index, index) -> !fir.boxchar<1>170 return171}172 173// -----174func.func @bad_designate_indices_1(%arg0 : !fir.ref<i32>) {175 %c1 = arith.constant 1 : index176 // expected-error@+1 {{'hlfir.designate' op indices number must match memref rank}}177 %0 = hlfir.designate %arg0 (%c1, %c1): (!fir.ref<i32>, index, index) -> !fir.ref<i32>178 return179}180 181// -----182func.func @bad_designate_indices_2(%arg0 : !fir.ref<!fir.array<10xi32>>) {183 %c1 = arith.constant 1 : index184 // expected-error@+1 {{'hlfir.designate' op indices number must match memref rank}}185 %0 = hlfir.designate %arg0 (%c1, %c1): (!fir.ref<!fir.array<10xi32>>, index, index) -> !fir.ref<i32>186 return187}188 189// -----190func.func @bad_designate_substring_2(%arg0 : !fir.ref<i32>) {191 %c1 = arith.constant 1 : index192 // expected-error@+1 {{'hlfir.designate' op memref or component must have character type if substring indices are provided}}193 %0 = hlfir.designate %arg0 substr %c1, %c1: (!fir.ref<i32>, index, index) -> !fir.boxchar<1>194 return195}196 197// -----198func.func @bad_designate_cmplx_part(%arg0 : !fir.ref<!fir.array<10xi32>>) {199 %c1 = arith.constant 1 : index200 // expected-error@+1 {{'hlfir.designate' op memref or component must have complex type if complex_part is provided}}201 %0 = hlfir.designate %arg0 (%c1) imag: (!fir.ref<!fir.array<10xi32>>, index) -> !fir.ref<i32>202 return203}204 205// -----206func.func @bad_designate_out_rank(%arg0 : !fir.ref<!fir.array<10xi32>>) {207 %c1 = arith.constant 1 : index208 // expected-error@+1 {{'hlfir.designate' op result type rank is not consistent with operands, expected rank 1}}209 %0 = hlfir.designate %arg0 (%c1:%c1:%c1): (!fir.ref<!fir.array<10xi32>>, index, index, index) -> !fir.ref<i32>210 return211}212 213// -----214func.func @bad_designate_out_type(%arg0 : !fir.ref<complex<f32>>) {215 // expected-error@+1 {{'hlfir.designate' op result element type is not consistent with operands, expected 'f32'}}216 %0 = hlfir.designate %arg0 imag: (!fir.ref<complex<f32>>) -> !fir.ref<complex<f64>>217 return218}219 220// -----221func.func @bad_designate_out_type(%arg0 : !fir.ref<!fir.box<complex<f32>>>) {222 // 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}}223 %0 = hlfir.designate %arg0 imag: (!fir.ref<!fir.box<complex<f32>>>) -> !fir.ref<!fir.box<f32>>224 return225}226 227// -----228func.func @bad_designate_shape(%arg0 : !fir.ref<!fir.array<10xi32>>) {229 %c1 = arith.constant 1 : index230 // 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:%c1:%c1): (!fir.ref<!fir.array<10xi32>>, index, index, index) -> !fir.box<!fir.array<?xi32>>232 return233}234 235// -----236func.func @bad_designate_shape_2(%arg0 : !fir.ref<!fir.array<10xi32>>) {237 %c1 = arith.constant 1 : index238 %shape = fir.undefined !fir.shape<1>239 // 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}}240 %0 = hlfir.designate %arg0 (%c1) shape %shape: (!fir.ref<!fir.array<10xi32>>, index, !fir.shape<1>) -> !fir.ref<i32>241 return242}243 244// -----245func.func @bad_designate_len_params(%arg0 : !fir.ref<!fir.char<1,10>>) {246 %c1 = arith.constant 1 : index247 // expected-error@+1 {{'hlfir.designate' op must be provided one length parameter when the result is a character}}248 %0 = hlfir.designate %arg0 substr %c1, %c1: (!fir.ref<!fir.char<1,10>>, index, index) -> !fir.boxchar<1>249 return250}251 252// -----253func.func @bad_designate_len_params_2(%arg0 : !fir.box<!fir.array<?x!fir.type<pdt(param:i32){field:i32}>>>) {254 %c1 = arith.constant 1 : index255 // expected-error@+1 {{'hlfir.designate' op must be provided the same number of length parameters as in the result derived type}}256 %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}>>257 return258}259 260// -----261func.func @bad_designate_len_params_3(%arg0 : !fir.box<!fir.array<?xi32>>) {262 %c1 = arith.constant 1 : index263 // expected-error@+1 {{'hlfir.designate' op must not be provided length parameters if the result type does not have length parameters}}264 %0 = hlfir.designate %arg0(%c1) typeparams %c1 : (!fir.box<!fir.array<?xi32>>, index, index) -> !fir.ref<i32>265 return266}267 268// -----269func.func @bad_concat(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<1,20>>) {270 %c30 = arith.constant 30 : index271 // expected-error@+1 {{'hlfir.concat' op result #0 must be any character scalar expression type, but got '!fir.ref<!fir.char<1,30>>'}}272 %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>>)273 return274}275 276// -----277func.func @bad_concat_2(%arg0: !fir.ref<!fir.array<100x!fir.char<1,10>>>, %arg1: !fir.ref<!fir.array<100x!fir.char<1,20>>>) {278 %c30 = arith.constant 30 : index279 // 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>>>'}}280 %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>>)281 return282}283 284// -----285func.func @bad_concat_3(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<i32>) {286 %c30 = arith.constant 30 : index287 // expected-error@+1 {{'hlfir.concat' op operand #1 must be variadic of any character scalar type, but got '!fir.ref<i32>'}}288 %0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<i32>, index) -> (!hlfir.expr<!fir.char<1,30>>)289 return290}291 292// -----293func.func @bad_concat_4(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<2,20>>) {294 %c30 = arith.constant 30 : index295 // expected-error@+1 {{'hlfir.concat' op strings must have the same KIND as the result type}}296 %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>>)297 return298}299 300// -----301func.func @bad_concat_4(%arg0: !fir.ref<!fir.char<1,30>>) {302 %c30 = arith.constant 30 : index303 // expected-error@+1 {{'hlfir.concat' op must be provided at least two string operands}}304 %0 = hlfir.concat %arg0 len %c30 : (!fir.ref<!fir.char<1,30>>, index) -> (!hlfir.expr<!fir.char<1,30>>)305 return306}307 308// -----309func.func @bad_cmpchar_1(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<2,10>>) {310 // expected-error@+1 {{'hlfir.cmpchar' op character arguments must have the same KIND}}311 %0 = hlfir.cmpchar ne %arg0 %arg1 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<2,10>>) -> i1312}313 314func.func @bad_cmpchar_2(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<1,10>>) {315 // expected-error@+1 {{'hlfir.cmpchar' op expected signed predicate}}316 %0 = hlfir.cmpchar ugt %arg0 %arg1 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<1,10>>) -> i1317}318 319// -----320func.func @bad_index_1(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<2,10>>) {321 // expected-error@+1 {{'hlfir.index' op character arguments must have the same KIND}}322 %0 = hlfir.index %arg0 in %arg1 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<2,10>>) -> i32323}324 325// -----326func.func @bad_any1(%arg0: !hlfir.expr<?x!fir.logical<4>>) {327 // expected-error@+1 {{'hlfir.any' op result must have the same element type as MASK argument}}328 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !fir.logical<8>329}330 331// -----332func.func @bad_any2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) {333 // expected-error@+1 {{'hlfir.any' op result must have the same element type as MASK argument}}334 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x!fir.logical<8>>335}336 337// -----338func.func @bad_any3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){339 // expected-error@+1 {{'hlfir.any' op result rank must be one less than MASK}}340 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>>341}342 343// -----344func.func @bad_any4(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) {345 // expected-error@+1 {{'hlfir.any' op result must be an array}}346 %0 = hlfir.any %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<!fir.logical<4>>347}348 349// -----350func.func @bad_any5(%arg0: !hlfir.expr<?x!fir.logical<4>>) {351 // expected-error@+1 {{'hlfir.any' op result must be of logical type}}352 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> i32353}354 355// -----356func.func @bad_any6(%arg0: !hlfir.expr<?x!fir.logical<4>>) {357 // expected-error@+1 {{'hlfir.any' op result must be of logical type}}358 %0 = hlfir.any %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !hlfir.expr<!fir.logical<4>>359}360 361// -----362func.func @bad_all1(%arg0: !hlfir.expr<?x!fir.logical<4>>) {363 // expected-error@+1 {{'hlfir.all' op result must have the same element type as MASK argument}}364 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !fir.logical<8>365}366 367// -----368func.func @bad_all2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) {369 // expected-error@+1 {{'hlfir.all' op result must have the same element type as MASK argument}}370 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x!fir.logical<8>>371}372 373// -----374func.func @bad_all3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){375 // expected-error@+1 {{'hlfir.all' op result rank must be one less than MASK}}376 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>>377}378 379// -----380func.func @bad_all4(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) {381 // expected-error@+1 {{'hlfir.all' op result must be an array}}382 %0 = hlfir.all %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<!fir.logical<4>>383}384 385// -----386func.func @bad_all5(%arg0: !hlfir.expr<?x!fir.logical<4>>) {387 // expected-error@+1 {{'hlfir.all' op result must be of logical type}}388 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> i32389}390 391// -----392func.func @bad_all6(%arg0: !hlfir.expr<?x!fir.logical<4>>) {393 // expected-error@+1 {{'hlfir.all' op result must be of logical type}}394 %0 = hlfir.all %arg0 : (!hlfir.expr<?x!fir.logical<4>>) -> !hlfir.expr<!fir.logical<4>>395}396 397// -----398func.func @bad_count1(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32) {399 // expected-error@+1 {{'hlfir.count' op result must be an array}}400 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<i32>401}402 403// -----404func.func @bad_count2(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: i32){405 // expected-error@+1 {{'hlfir.count' op result rank must be one less than MASK}}406 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, i32) -> !hlfir.expr<?x?x!fir.logical<4>>407}408 409// -----410func.func @bad_count3(%arg0: !hlfir.expr<?x!fir.logical<4>>, %arg1: i32) {411 // expected-error@+1 {{'hlfir.count' op result must be of numerical array type}}412 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x!fir.logical<4>>, i32) -> !hlfir.expr<i32>413}414 415// -----416func.func @bad_count4(%arg0: !hlfir.expr<?x!fir.logical<4>>, %arg1: i32) {417 // expected-error@+1 {{'hlfir.count' op result must be of numerical scalar type}}418 %0 = hlfir.count %arg0 dim %arg1 : (!hlfir.expr<?x!fir.logical<4>>, i32) -> !fir.logical<4>419}420 421// -----422func.func @bad_maxval1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {423 // expected-error@+1 {{'hlfir.maxval' op result must have the same element type as ARRAY argument}}424 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32425}426 427// -----428func.func @bad_maxval2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {429 // expected-warning@+1 {{MASK must be conformable to ARRAY}}430 %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>431}432 433// -----434func.func @bad_maxval3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {435 // expected-warning@+1 {{MASK must be conformable to ARRAY}}436 %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>437}438 439// -----440func.func @bad_maxval4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {441 // expected-error@+1 {{'hlfir.maxval' op result rank must be one less than ARRAY}}442 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>443}444 445// -----446func.func @bad_maxval5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {447 // expected-error@+1 {{'hlfir.maxval' op result must be of numerical scalar type}}448 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>449}450 451// -----452func.func @bad_maxval6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){453 // expected-error@+1 {{'hlfir.maxval' op result must be an array}}454 %0 = hlfir.maxval %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>455}456 457// -----458func.func @bad_maxval7(%arg0: !hlfir.expr<?xi32>){459 // expected-error@+1 {{'hlfir.maxval' op result must be of numerical scalar type}}460 %0 = hlfir.maxval %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32>461}462 463// -----464func.func @bad_maxval8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {465 // expected-error@+1 {{'hlfir.maxval' op result must have the same element type as ARRAY argument}}466 %0 = hlfir.maxval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> i32467}468 469// -----470func.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>>>) {471 // expected-warning@+1 {{MASK must be conformable to ARRAY}}472 %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,?>>473}474 475// -----476func.func @bad_maxval10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {477 // expected-warning@+1 {{MASK must be conformable to ARRAY}}478 %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,?>>479}480 481// -----482func.func @bad_maxval11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {483 // expected-error@+1 {{'hlfir.maxval' op result rank must be one less than ARRAY}}484 %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,?>>485}486 487// -----488func.func @bad_maxval12(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {489 // expected-error@+1 {{'hlfir.maxval' op result must be scalar character}}490 %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,?>>491}492 493// -----494func.func @bad_maxval13(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32){495 // expected-error@+1 {{'hlfir.maxval' op result must be an array}}496 %0 = hlfir.maxval %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32) -> !hlfir.expr<!fir.char<1,?>>497}498 499// -----500func.func @bad_minval1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {501 // expected-error@+1 {{'hlfir.minval' op result must have the same element type as ARRAY argument}}502 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32503}504 505// -----506func.func @bad_minval2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {507 // expected-warning@+1 {{MASK must be conformable to ARRAY}}508 %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>509}510 511// -----512func.func @bad_minval3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {513 // expected-warning@+1 {{MASK must be conformable to ARRAY}}514 %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>515}516 517// -----518func.func @bad_minval4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {519 // expected-error@+1 {{'hlfir.minval' op result rank must be one less than ARRAY}}520 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>521}522 523// -----524func.func @bad_minval5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {525 // expected-error@+1 {{'hlfir.minval' op result must be of numerical scalar type}}526 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>527}528 529// -----530func.func @bad_minval6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){531 // expected-error@+1 {{'hlfir.minval' op result must be an array}}532 %0 = hlfir.minval %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>533}534 535// -----536func.func @bad_minval7(%arg0: !hlfir.expr<?xi32>){537 // expected-error@+1 {{'hlfir.minval' op result must be of numerical scalar type}}538 %0 = hlfir.minval %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32>539}540 541// -----542func.func @bad_minval8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {543 // expected-error@+1 {{'hlfir.minval' op result must have the same element type as ARRAY argument}}544 %0 = hlfir.minval %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x!fir.char<1,?>>, i32, !fir.box<!fir.logical<4>>) -> i32545}546 547// -----548func.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>>>) {549 // expected-warning@+1 {{MASK must be conformable to ARRAY}}550 %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,?>>551}552 553// -----554func.func @bad_minval10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {555 // expected-warning@+1 {{MASK must be conformable to ARRAY}}556 %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,?>>557}558 559// -----560func.func @bad_minval11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {561 // expected-error@+1 {{'hlfir.minval' op result rank must be one less than ARRAY}}562 %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,?>>563}564 565// -----566func.func @bad_minval12(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {567 // expected-error@+1 {{'hlfir.minval' op result must be scalar character}}568 %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,?>>569}570 571// -----572func.func @bad_minval13(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32){573 // expected-error@+1 {{'hlfir.minval' op result must be an array}}574 %0 = hlfir.minval %arg0 dim %arg1 : (!hlfir.expr<?x?x!fir.char<1,?>>, i32) -> !hlfir.expr<!fir.char<1,?>>575}576 577// -----578func.func @bad_minloc1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {579 // expected-error@+1 {{'hlfir.minloc' op result must be scalar integer}}580 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32581}582 583// -----584func.func @bad_minloc2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {585 // expected-warning@+1 {{MASK must be conformable to ARRAY}}586 %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>587}588 589// -----590func.func @bad_minloc3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {591 // expected-warning@+1 {{MASK must be conformable to ARRAY}}592 %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>593}594 595// -----596func.func @bad_minloc4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {597 // expected-error@+1 {{'hlfir.minloc' op result rank must be one less than ARRAY}}598 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>599}600 601// -----602func.func @bad_minloc5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {603 // expected-error@+1 {{'hlfir.minloc' op result must be scalar integer}}604 %0 = hlfir.minloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>605}606 607// -----608func.func @bad_minloc6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){609 // expected-error@+1 {{'hlfir.minloc' op result must be an array}}610 %0 = hlfir.minloc %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>611}612 613// -----614func.func @bad_minloc7(%arg0: !hlfir.expr<?xi32>){615 // expected-error@+1 {{'hlfir.minloc' op result must be of numerical expr type}}616 %0 = hlfir.minloc %arg0 : (!hlfir.expr<?xi32>) -> i32617}618 619// -----620func.func @bad_minloc8(%arg0: !hlfir.expr<?xi32>){621 // expected-error@+1 {{'hlfir.minloc' op result must have integer elements}}622 %0 = hlfir.minloc %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<?xf32>623}624 625// -----626func.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>>>) {627 // expected-warning@+1 {{MASK must be conformable to ARRAY}}628 %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,?>>629}630 631// -----632func.func @bad_minloc10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {633 // expected-warning@+1 {{MASK must be conformable to ARRAY}}634 %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,?>>635}636 637// -----638func.func @bad_minloc11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {639 // expected-error@+1 {{'hlfir.minloc' op result rank must be one less than ARRAY}}640 %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>641}642 643// -----644func.func @bad_maxloc1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {645 // expected-error@+1 {{'hlfir.maxloc' op result must be scalar integer}}646 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32647}648 649// -----650func.func @bad_maxloc2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {651 // expected-warning@+1 {{MASK must be conformable to ARRAY}}652 %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>653}654 655// -----656func.func @bad_maxloc3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {657 // expected-warning@+1 {{MASK must be conformable to ARRAY}}658 %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>659}660 661// -----662func.func @bad_maxloc4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {663 // expected-error@+1 {{'hlfir.maxloc' op result rank must be one less than ARRAY}}664 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>665}666 667// -----668func.func @bad_maxloc5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {669 // expected-error@+1 {{'hlfir.maxloc' op result must be scalar integer}}670 %0 = hlfir.maxloc %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>671}672 673// -----674func.func @bad_maxloc6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){675 // expected-error@+1 {{'hlfir.maxloc' op result must be an array}}676 %0 = hlfir.maxloc %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>677}678 679// -----680func.func @bad_maxloc7(%arg0: !hlfir.expr<?xi32>){681 // expected-error@+1 {{'hlfir.maxloc' op result must be of numerical expr type}}682 %0 = hlfir.maxloc %arg0 : (!hlfir.expr<?xi32>) -> i32683}684 685// -----686func.func @bad_maxloc8(%arg0: !hlfir.expr<?xi32>){687 // expected-error@+1 {{'hlfir.maxloc' op result must have integer elements}}688 %0 = hlfir.maxloc %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<?xf32>689}690 691// -----692func.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>>>) {693 // expected-warning@+1 {{MASK must be conformable to ARRAY}}694 %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,?>>695}696 697// -----698func.func @bad_maxloc10(%arg0: !hlfir.expr<?x5x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {699 // expected-warning@+1 {{MASK must be conformable to ARRAY}}700 %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,?>>701}702 703// -----704func.func @bad_maxloc11(%arg0: !hlfir.expr<?x?x!fir.char<1,?>>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {705 // expected-error@+1 {{'hlfir.maxloc' op result rank must be one less than ARRAY}}706 %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>707}708 709 710// -----711func.func @bad_product1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {712 // expected-error@+1 {{'hlfir.product' op result must have the same element type as ARRAY argument}}713 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32714}715 716// -----717func.func @bad_product2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {718 // expected-warning@+1 {{MASK must be conformable to ARRAY}}719 %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>720}721 722// -----723func.func @bad_product3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {724 // expected-warning@+1 {{MASK must be conformable to ARRAY}}725 %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>726}727 728// -----729func.func @bad_product4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {730 // expected-error@+1 {{'hlfir.product' op result rank must be one less than ARRAY}}731 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>732}733 734// -----735func.func @bad_product5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {736 // expected-error@+1 {{'hlfir.product' op result must be of numerical scalar type}}737 %0 = hlfir.product %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>738}739 740// -----741func.func @bad_product6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){742 // expected-error@+1 {{'hlfir.product' op result must be an array}}743 %0 = hlfir.product %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>744}745 746// -----747func.func @bad_product7(%arg0: !hlfir.expr<?xi32>){748 // expected-error@+1 {{'hlfir.product' op result must be of numerical scalar type}}749 %0 = hlfir.product %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32>750}751 752// -----753func.func @bad_sum1(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {754 // expected-error@+1 {{'hlfir.sum' op result must have the same element type as ARRAY argument}}755 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> f32756}757 758// -----759func.func @bad_sum2(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<?x?x?x?x?x!fir.logical<4>>>) {760 // expected-warning@+1 {{MASK must be conformable to ARRAY}}761 %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>762}763 764// -----765func.func @bad_sum3(%arg0: !hlfir.expr<?x5x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.array<2x6x?x!fir.logical<4>>>) {766 // expected-warning@+1 {{MASK must be conformable to ARRAY}}767 %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>768}769 770// -----771func.func @bad_sum4(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {772 // expected-error@+1 {{'hlfir.sum' op result rank must be one less than ARRAY}}773 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?x?xi32>, i32, !fir.box<!fir.logical<4>>) -> !hlfir.expr<?x?xi32>774}775 776// -----777func.func @bad_sum5(%arg0: !hlfir.expr<?xi32>, %arg1: i32, %arg2: !fir.box<!fir.logical<4>>) {778 // expected-error@+1 {{'hlfir.sum' op result must be of numerical scalar type}}779 %0 = hlfir.sum %arg0 dim %arg1 mask %arg2 : (!hlfir.expr<?xi32>, i32, !fir.box<!fir.logical<4>>) -> !fir.logical<4>780}781 782// -----783func.func @bad_sum6(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32){784 // expected-error@+1 {{'hlfir.sum' op result must be an array}}785 %0 = hlfir.sum %arg0 dim %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<i32>786}787 788// -----789func.func @bad_sum7(%arg0: !hlfir.expr<?xi32>){790 // expected-error@+1 {{'hlfir.sum' op result must be of numerical scalar type}}791 %0 = hlfir.sum %arg0 : (!hlfir.expr<?xi32>) -> !hlfir.expr<i32>792}793 794// -----795func.func @bad_matmul1(%arg0: !hlfir.expr<?x?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) {796 // expected-error@+1 {{'hlfir.matmul' op array must have either rank 1 or rank 2}}797 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32>798 return799}800 801// -----802func.func @bad_matmul2(%arg0: !hlfir.expr<?xi32>, %arg1: !hlfir.expr<?xi32>) {803 // expected-error@+1 {{'hlfir.matmul' op at least one array must have rank 2}}804 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?x?xi32>805 return806}807 808// -----809func.func @bad_matmul3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: !hlfir.expr<?x?xi32>) {810 // expected-error@+1 {{'hlfir.matmul' op if one array is logical, so should the other be}}811 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32>812 return813}814 815// -----816func.func @bad_matmul4(%arg0: !hlfir.expr<?x2xi32>, %arg1: !hlfir.expr<200x?xi32>) {817 // expected-error@+1 {{'hlfir.matmul' op the last dimension of LHS should match the first dimension of RHS}}818 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x2xi32>, !hlfir.expr<200x?xi32>) -> !hlfir.expr<?x?xi32>819 return820}821 822// -----823func.func @bad_matmul5(%arg0: !hlfir.expr<?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) {824 // expected-error@+1 {{'hlfir.matmul' op the result type should be a logical only if the argument types are logical}}825 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?x!fir.logical<4>>826 return827}828 829// -----830func.func @bad_matmul6(%arg0: !hlfir.expr<1x2xi32>, %arg1: !hlfir.expr<2x3xi32>) {831 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}}832 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<1x2xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<10x30xi32>833 return834}835 836// -----837func.func @bad_matmul7(%arg0: !hlfir.expr<1x2xi32>, %arg1: !hlfir.expr<2xi32>) {838 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}}839 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<1x2xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<1x3xi32>840 return841}842 843// -----844func.func @bad_matmul8(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x3xi32>) {845 // expected-error@+1 {{'hlfir.matmul' op incorrect result shape}}846 %0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<1x3xi32>847 return848}849 850// -----851func.func @bad_dot_product1(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x3xi32>) {852 // expected-error@+1 {{'hlfir.dot_product' op both arrays must have rank 1}}853 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x3xi32>) -> i32854 return855}856 857// -----858func.func @bad_dot_product2(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<3xi32>) {859 // expected-error@+1 {{'hlfir.dot_product' op both arrays must have the same size}}860 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<3xi32>) -> i32861 return862}863 864// -----865func.func @bad_dot_product3(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2x!fir.logical<4>>) {866 // expected-error@+1 {{'hlfir.dot_product' op if one array is logical, so should the other be}}867 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2x!fir.logical<4>>) -> i32868 return869}870 871// -----872func.func @bad_dot_product4(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2xi32>) {873 // expected-error@+1 {{'hlfir.dot_product' op the result type should be a logical only if the argument types are logical}}874 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2xi32>) -> !fir.logical<4>875 return876}877 878// -----879func.func @bad_dot_product5(%arg0: !hlfir.expr<2xi32>, %arg1: !hlfir.expr<2xi32>) {880 // expected-error@+1 {{'hlfir.dot_product' op the result must be of scalar numerical or logical type}}881 %0 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<2xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<i32>882 return883}884 885// -----886func.func @bad_transpose1(%arg0: !hlfir.expr<2xi32>) {887 // expected-error@+1 {{'hlfir.transpose' op input and output arrays should have rank 2}}888 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2xi32>) -> !hlfir.expr<2xi32>889 return890}891 892// -----893func.func @bad_transpose2(%arg0: !hlfir.expr<2x3xi32>) {894 // expected-error@+1 {{'hlfir.transpose' op output shape does not match input array}}895 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2x3xi32>) -> !hlfir.expr<2x2xi32>896 return897}898 899// -----900func.func @bad_transpose3(%arg0: !hlfir.expr<2x3xi32>) {901 // expected-error@+1 {{'hlfir.transpose' op input and output arrays should have the same element type}}902 %0 = hlfir.transpose %arg0 : (!hlfir.expr<2x3xi32>) -> !hlfir.expr<3x2xf64>903 return904}905 906// -----907func.func @bad_matmultranspose1(%arg0: !hlfir.expr<?x?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) {908 // expected-error@+1 {{'hlfir.matmul_transpose' op array must have either rank 1 or rank 2}}909 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32>910 return911}912 913// -----914func.func @bad_matmultranspose2(%arg0: !hlfir.expr<?xi32>, %arg1: !hlfir.expr<?xi32>) {915 // expected-error@+1 {{'hlfir.matmul_transpose' op array must have either rank 1 or rank 2}}916 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?x?xi32>917 return918}919 920// -----921func.func @bad_matmultranspose3(%arg0: !hlfir.expr<?x?x!fir.logical<4>>, %arg1: !hlfir.expr<?x?xi32>) {922 // expected-error@+1 {{'hlfir.matmul_transpose' op if one array is logical, so should the other be}}923 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?x!fir.logical<4>>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?xi32>924 return925}926 927// -----928func.func @bad_matmultranspose5(%arg0: !hlfir.expr<?x?xi32>, %arg1: !hlfir.expr<?x?xi32>) {929 // expected-error@+1 {{'hlfir.matmul_transpose' op the result type should be a logical only if the argument types are logical}}930 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?xi32>, !hlfir.expr<?x?xi32>) -> !hlfir.expr<?x?x!fir.logical<4>>931 return932}933 934// -----935func.func @bad_matmultranspose6(%arg0: !hlfir.expr<2x1xi32>, %arg1: !hlfir.expr<2x3xi32>) {936 // expected-error@+1 {{'hlfir.matmul_transpose' op incorrect result shape}}937 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<2x1xi32>, !hlfir.expr<2x3xi32>) -> !hlfir.expr<10x30xi32>938 return939}940 941// -----942func.func @bad_matmultranspose7(%arg0: !hlfir.expr<2x1xi32>, %arg1: !hlfir.expr<2xi32>) {943 // expected-error@+1 {{'hlfir.matmul_transpose' op incorrect result shape}}944 %0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<2x1xi32>, !hlfir.expr<2xi32>) -> !hlfir.expr<1x3xi32>945 return946}947 948// -----949func.func @bad_assign_1(%arg0: !fir.box<!fir.array<?xi32>>, %arg1: !fir.box<!fir.array<?xi32>>) {950 // expected-error@+1 {{'hlfir.assign' op lhs must be an allocatable when `realloc` is set}}951 hlfir.assign %arg1 to %arg0 realloc : !fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>952 return953}954 955// -----956func.func @bad_assign_2(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %arg1: !fir.box<!fir.array<?xi32>>) {957 // 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}}958 hlfir.assign %arg1 to %arg0 realloc keep_lhs_len : !fir.box<!fir.array<?xi32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>959 return960}961 962// -----963func.func @bad_parent_comp1(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) {964 // expected-error@+1 {{'hlfir.parent_comp' op must be provided a shape if and only if the base is an array}}965 %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}>>>966 return967}968 969// -----970func.func @bad_parent_comp2(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) {971 %c10 = arith.constant 10 : index972 %1 = fir.shape %c10 : (index) -> !fir.shape<1>973 // expected-error@+1 {{'hlfir.parent_comp' op result type rank must match input type rank}}974 %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}>>>975 return976}977 978// -----979func.func @bad_parent_comp3(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) {980 %c10 = arith.constant 10 : index981 %1 = fir.shape %c10 : (index) -> !fir.shape<1>982 // expected-error@+1 {{'hlfir.parent_comp' op result type extents are inconsistent with memref type}}983 %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}>>>984 return985}986 987// -----988func.func @bad_parent_comp4(%arg0: !fir.ref<!fir.type<t2{i:i32,j:i32}>>) {989 // expected-error@+1 {{'hlfir.parent_comp' op result type and input type must be derived types}}990 %1 = hlfir.parent_comp %arg0 : (!fir.ref<!fir.type<t2{i:i32,j:i32}>>) -> !fir.ref<i32>991 return992}993 994// -----995func.func @bad_parent_comp5(%arg0: !fir.class<!fir.type<t2{i:i32,j:i32}>>) {996 // expected-error@+1 {{'hlfir.parent_comp' op result type must not be polymorphic}}997 %2 = hlfir.parent_comp %arg0 : (!fir.class<!fir.type<t2{i:i32,j:i32}>>) -> !fir.class<!fir.type<t1{i:i32}>>998 return999}1000 1001// -----1002func.func @bad_parent_comp6(%arg0: !fir.box<!fir.array<10x!fir.type<t2{i:i32,j:i32}>>>) {1003 %c10 = arith.constant 10 : index1004 %1 = fir.shape %c10 : (index) -> !fir.shape<1>1005 // expected-error@+1 {{'hlfir.parent_comp' op result type must be a fir.box if the result is an array or has length parameters}}1006 %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}>>>1007 return1008}1009 1010// -----1011func.func @bad_shapeof(%arg0: !hlfir.expr<!fir.char<1,10>>) {1012 // expected-error@+1 {{'hlfir.shape_of' op cannot get the shape of a shape-less expression}}1013 %0 = hlfir.shape_of %arg0 : (!hlfir.expr<!fir.char<1,10>>) -> !fir.shape<1>1014}1015 1016// -----1017func.func @bad_shapeof2(%arg0: !hlfir.expr<10xi32>) {1018 // expected-error@+1 {{'hlfir.shape_of' op result rank and expr rank do not match}}1019 %0 = hlfir.shape_of %arg0 : (!hlfir.expr<10xi32>) -> !fir.shape<42>1020}1021 1022// -----1023func.func @bad_getextent(%arg0: !fir.shape<1>) {1024 // expected-error@+1 {{'hlfir.get_extent' op dimension index out of bounds}}1025 %0 = hlfir.get_extent %arg0 {dim = 1 : index} : (!fir.shape<1>) -> index1026}1027 1028// -----1029func.func @bad_region_assign_1(%x: !fir.box<!fir.array<?xf32>>) {1030// expected-error@+1 {{'hlfir.region_assign' op right-hand side region must be terminated by an hlfir.yield}}1031 hlfir.region_assign {1032 %c100 = arith.constant 100 : index1033 } to {1034 hlfir.yield %x : !fir.box<!fir.array<?xf32>>1035 }1036 return1037}1038 1039// -----1040func.func @bad_region_assign_2(%x: !fir.box<!fir.array<?xf32>>) {1041// expected-error@+1 {{'hlfir.region_assign' op left-hand side region must be terminated by an hlfir.yield or hlfir.elemental_addr}}1042 hlfir.region_assign {1043 hlfir.yield %x : !fir.box<!fir.array<?xf32>>1044 } to {1045 %c100 = arith.constant 100 : index1046 } user_defined_assign (%rhs: !fir.ref<i64>) to (%lhs: !fir.ref<f32>) {1047 }1048 return1049}1050 1051// -----1052func.func @bad_element_addr_1(%x: !fir.ref<!fir.array<20xf32>>) {1053 %c20 = arith.constant 20 : index1054 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1>1055 hlfir.region_assign {1056 hlfir.yield %x : !fir.ref<!fir.array<20xf32>>1057 } to {1058 // expected-error@+1 {{'hlfir.elemental_addr' op body must compute the address of a scalar entity}}1059 hlfir.elemental_addr %vector_shape : !fir.shape<1> {1060 ^bb0(%i: index):1061 %c42 = arith.constant 42.0 : f321062 hlfir.yield %c42 : f321063 }1064 }1065 return1066}1067 1068// -----1069func.func @bad_element_addr_2(%x: !fir.ref<!fir.array<20xf32>>) {1070 %c20 = arith.constant 20 : index1071 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1>1072 hlfir.region_assign {1073 hlfir.yield %x : !fir.ref<!fir.array<20xf32>>1074 } to {1075 // expected-error@+1 {{'hlfir.elemental_addr' op body must compute the address of a scalar entity}}1076 hlfir.elemental_addr %vector_shape : !fir.shape<1> {1077 ^bb0(%i: index):1078 hlfir.yield %x : !fir.ref<!fir.array<20xf32>>1079 }1080 }1081 return1082}1083 1084// -----1085func.func @bad_element_addr_3(%x: !fir.ref<!fir.array<20xf32>>) {1086 %c20 = arith.constant 20 : index1087 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1>1088 hlfir.region_assign {1089 hlfir.yield %x : !fir.ref<!fir.array<20xf32>>1090 } to {1091 // expected-error@+1 {{'hlfir.elemental_addr' op body region must be terminated by an hlfir.yield}}1092 hlfir.elemental_addr %vector_shape : !fir.shape<1> {1093 ^bb0(%i: index):1094 %c42 = arith.constant 42.0 : f321095 }1096 }1097 return1098}1099 1100// -----1101func.func @bad_element_addr_4(%x: !fir.ref<!fir.array<20xf32>>, %y: !fir.ref<!fir.array<20x20xf32>>) {1102 %c20 = arith.constant 20 : index1103 %vector_shape = fir.shape %c20 : (index) -> !fir.shape<1>1104 hlfir.region_assign {1105 hlfir.yield %x : !fir.ref<!fir.array<20xf32>>1106 } to {1107 // expected-error@+1 {{'hlfir.elemental_addr' op body number of indices must match shape rank}}1108 hlfir.elemental_addr %vector_shape : !fir.shape<1> {1109 ^bb0(%i: index, %j: index):1110 %elt = hlfir.designate %y(%i, %j) : (!fir.ref<!fir.array<20x20xf32>>, index, index) -> !fir.ref<f32>1111 hlfir.yield %elt : !fir.ref<f32>1112 }1113 }1114 return1115}1116 1117// -----1118func.func @bad_forall(%x : !fir.box<!fir.array<10xf32>>, %y: f32, %bad : !fir.ref<!fir.array<10xindex>>) {1119 // expected-error@+1 {{'hlfir.forall' op region #0 ('lb_region') failed to verify constraint: single block region that yields an integer scalar value}}1120 hlfir.forall lb {1121 hlfir.yield %bad : !fir.ref<!fir.array<10xindex>>1122 } ub {1123 %c10 = arith.constant 10 : index1124 hlfir.yield %c10 : index1125 } (%i : index) {1126 hlfir.region_assign {1127 hlfir.yield %y : f321128 } to {1129 %xi = hlfir.designate %x(%i) : (!fir.box<!fir.array<10xf32>>, index) -> !fir.ref<f32>1130 hlfir.yield %xi : !fir.ref<f32>1131 }1132 }1133 return1134}1135 1136// -----1137func.func @bad_forall_2(%x : !fir.box<!fir.array<10xf32>>, %y: f32) {1138 // expected-error@+1 {{'hlfir.forall' op body region must only contain OrderedAssignmentTreeOpInterface operations or fir.end}}1139 hlfir.forall lb {1140 %c1 = arith.constant 1 : index1141 hlfir.yield %c1 : index1142 } ub {1143 %c10 = arith.constant 10 : index1144 hlfir.yield %c10 : index1145 } (%i : index) {1146 %xi = hlfir.designate %x(%i) : (!fir.box<!fir.array<10xf32>>, index) -> !fir.ref<f32>1147 hlfir.assign %y to %xi : f32, !fir.ref<f32>1148 }1149 return1150}1151 1152// -----1153func.func @bad_forall_mask(%i: index) {1154 // expected-error@+1 {{'hlfir.forall_mask' op must be inside the body region of an hlfir.forall}}1155 hlfir.forall_mask {1156 %mask = fir.call @some_condition(%i) : (index) -> i11157 hlfir.yield %mask : i11158 } do {1159 }1160 return1161}1162 1163// -----1164func.func @bad_forall_mask_2(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>) {1165 %c1 = arith.constant 1 : index1166 hlfir.forall lb {1167 hlfir.yield %c1 : index1168 } ub {1169 hlfir.yield %c1 : index1170 } (%i: index) {1171 // expected-error@+1 {{'hlfir.forall_mask' op mask region must yield a scalar i1}}1172 hlfir.forall_mask {1173 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1174 } do {1175 }1176 }1177 return1178}1179 1180// -----1181func.func @bad_where_1(%bad_mask: !fir.ref<!fir.array<10xf32>>) {1182 // expected-error@+1 {{'hlfir.where' op mask region must yield a logical array}}1183 hlfir.where {1184 hlfir.yield %bad_mask : !fir.ref<!fir.array<10xf32>>1185 } do {1186 }1187 return1188}1189 1190// -----1191func.func @bad_where_2(%bad_mask: i1) {1192 // expected-error@+1 {{'hlfir.where' op mask region must yield a logical array}}1193 hlfir.where {1194 hlfir.yield %bad_mask : i11195 } do {1196 }1197 return1198}1199 1200// -----1201func.func @bad_where_3(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>, %n: index) {1202 // expected-error@+1 {{'hlfir.where' op body region must not contain hlfir.forall}}1203 hlfir.where {1204 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1205 } do {1206 hlfir.forall lb {1207 hlfir.yield %n : index1208 } ub {1209 hlfir.yield %n : index1210 } (%i: index) {1211 }1212 }1213 return1214}1215 1216// -----1217func.func @bad_elsewhere_1(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>, %bad_mask: i1) {1218 hlfir.where {1219 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1220 } do {1221 // expected-error@+1 {{'hlfir.elsewhere' op mask region must yield a logical array when provided}}1222 hlfir.elsewhere mask {1223 hlfir.yield %bad_mask : i11224 } do {1225 }1226 }1227 return1228}1229 1230// -----1231func.func @bad_elsewhere_2(%mask: !fir.ref<!fir.array<10x!fir.logical<4>>>) {1232 // expected-error@+1 {{'hlfir.elsewhere' op expects parent op to be one of 'hlfir.where, hlfir.elsewhere'}}1233 hlfir.elsewhere mask {1234 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1235 } do {1236 }1237 return1238}1239 1240// -----1241func.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>>) {1242 hlfir.where {1243 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1244 } do {1245 // expected-error@+1 {{'hlfir.elsewhere' op must be the last operation in the parent block}}1246 hlfir.elsewhere mask {1247 hlfir.yield %mask : !fir.ref<!fir.array<10x!fir.logical<4>>>1248 } do {1249 }1250 hlfir.region_assign {1251 hlfir.yield %y : !fir.box<!fir.array<?xf32>>1252 } to {1253 hlfir.yield %x : !fir.ref<!fir.array<10xf32>>1254 }1255 }1256 return1257}1258 1259// -----1260func.func @bad_get_length_1(%arg0: !hlfir.expr<i32>) {1261 // expected-error@+1 {{'hlfir.get_length' op operand #0 must be any character scalar or array expression type, but got '!hlfir.expr<i32>'}}1262 %1 = hlfir.get_length %arg0 : (!hlfir.expr<i32>) -> index1263 return1264}1265 1266// -----1267func.func @bad_get_length_2(%arg0: !hlfir.expr<?xi32>) {1268 // expected-error@+1 {{'hlfir.get_length' op operand #0 must be any character scalar or array expression type, but got '!hlfir.expr<?xi32>'}}1269 %1 = hlfir.get_length %arg0 : (!hlfir.expr<?xi32>) -> index1270 return1271}1272 1273// -----1274func.func @bad_get_length_3(%arg0: !hlfir.expr<!fir.boxchar<1>>) {1275 // 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>>'}}1276 %1 = hlfir.get_length %arg0 : (!hlfir.expr<!fir.boxchar<1>>) -> index1277 return1278}1279 1280// -----1281func.func @elemental_poly_1(%arg0: !fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>, %shape : index) {1282 %3 = fir.shape %shape : (index) -> !fir.shape<1>1283 // expected-error@+1 {{'hlfir.elemental' op operand #1 must be any polymorphic object, but got '!fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>'}}1284 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !fir.box<!fir.array<?x!fir.type<_QMtypesTt>>>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> {1285 ^bb0(%arg2: index):1286 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?>1287 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?>1288 }1289 return1290}1291 1292// -----1293func.func @elemental_poly_2(%arg0: !hlfir.expr<?x!fir.type<_QMtypesTt>>, %shape : index) {1294 %3 = fir.shape %shape : (index) -> !fir.shape<1>1295 // expected-error@+1 {{'hlfir.elemental' op operand #1 must be any polymorphic object, but got '!hlfir.expr<?x!fir.type<_QMtypesTt>>'}}1296 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !hlfir.expr<?x!fir.type<_QMtypesTt>>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> {1297 ^bb0(%arg2: index):1298 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?>1299 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?>1300 }1301 return1302}1303 1304// -----1305func.func @elemental_poly_3(%arg0: !hlfir.expr<?x!fir.type<_QMtypesTt>?>, %shape : index) {1306 %3 = fir.shape %shape : (index) -> !fir.shape<1>1307// expected-error@+1 {{'hlfir.elemental' op result must be polymorphic when mold is present and vice versa}}1308 %4 = hlfir.elemental %3 mold %arg0 unordered : (!fir.shape<1>, !hlfir.expr<?x!fir.type<_QMtypesTt>?>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>> {1309 ^bb0(%arg2: index):1310 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>>1311 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>>1312 }1313 return1314}1315 1316// -----1317func.func @elemental_poly_4(%shape : index) {1318 %3 = fir.shape %shape : (index) -> !fir.shape<1>1319// expected-error@+1 {{'hlfir.elemental' op result must be polymorphic when mold is present and vice versa}}1320 %4 = hlfir.elemental %3 unordered : (!fir.shape<1>) -> !hlfir.expr<?x!fir.type<_QMtypesTt>?> {1321 ^bb0(%arg2: index):1322 %6 = fir.undefined !hlfir.expr<!fir.type<_QMtypesTt>?>1323 hlfir.yield_element %6 : !hlfir.expr<!fir.type<_QMtypesTt>?>1324 }1325 return1326}1327 1328// -----1329func.func @destroy_with_finalize(%expr: !hlfir.expr<?xi32>) {1330// expected-error@+1 {{'hlfir.destroy' op the element type must be finalizable, when 'finalize' is set}}1331 hlfir.destroy %expr finalize : !hlfir.expr<?xi32>1332 return1333}1334 1335// -----1336 1337func.func @end_associate_with_alloc_comp(%var: !hlfir.expr<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>, %shape: !fir.shape<1>) {1338 %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)1339// expected-error@+1 {{'hlfir.end_associate' op that requires components deallocation must have var operand that is a Fortran entity}}1340 hlfir.end_associate %4#1, %4#2 : !fir.ref<!fir.array<?x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>, i11341 return1342}1343 1344// -----1345 1346func.func @bad_eval_in_mem_1() {1347 %c10 = arith.constant 10 : index1348 %1 = fir.shape %c10 : (index) -> !fir.shape<1>1349// 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>'}}1350 %2 = hlfir.eval_in_mem shape %1 : (!fir.shape<1>) -> !fir.array<10xf32> {1351 ^bb0(%arg0: !fir.ref<!fir.array<10xf32>>):1352 }1353 return1354}1355 1356// -----1357 1358func.func @bad_eval_in_mem_2() {1359 %c10 = arith.constant 10 : index1360 %1 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2>1361 // expected-error@+1 {{'hlfir.eval_in_mem' op `shape` rank must match the result rank}}1362 %2 = hlfir.eval_in_mem shape %1 : (!fir.shape<2>) -> !hlfir.expr<10xf32> {1363 ^bb0(%arg0: !fir.ref<!fir.array<10xf32>>):1364 }1365 return1366}1367 1368// -----1369 1370func.func @bad_eval_in_mem_3() {1371 // expected-error@+1 {{'hlfir.eval_in_mem' op must be provided one length parameter when the result is a character}}1372 %1 = hlfir.eval_in_mem : () -> !hlfir.expr<!fir.char<1,?>> {1373 ^bb0(%arg0: !fir.ref<!fir.char<1,?>>):1374 }1375 return1376}1377 1378// -----1379 1380func.func @bad_cshift1(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) {1381 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}}1382 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?x?xf32>1383 return1384}1385 1386// -----1387 1388func.func @bad_cshift2(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) {1389 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same rank}}1390 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?xi32>1391 return1392}1393 1394// -----1395 1396func.func @bad_cshift3(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1397 // expected-error@+1 {{'hlfir.cshift' op output array's shape conflicts with the input array's shape}}1398 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, i32) -> !hlfir.expr<2x3xi32>1399 return1400}1401 1402// -----1403 1404func.func @bad_cshift4(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1405 %c0 = arith.constant 0 : index1406 // expected-error@+1 {{'hlfir.cshift' op DIM must be >= 1}}1407 %0 = hlfir.cshift %arg0 %arg1 dim %c0 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32>1408 return1409}1410 1411// -----1412 1413func.func @bad_cshift5(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1414 %c10 = arith.constant 10 : index1415 // expected-error@+1 {{'hlfir.cshift' op DIM must be <= input array's rank}}1416 %0 = hlfir.cshift %arg0 %arg1 dim %c10 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32>1417 return1418}1419 1420// -----1421 1422func.func @bad_cshift6(%arg0: !hlfir.expr<2x2xi32>, %arg1: !hlfir.expr<2x2xi32>) {1423 // expected-error@+1 {{'hlfir.cshift' op SHIFT's rank must be 1 less than the input array's rank}}1424 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, !hlfir.expr<2x2xi32>) -> !hlfir.expr<2x2xi32>1425 return1426}1427 1428// -----1429 1430func.func @bad_cshift7(%arg0: !hlfir.expr<?x2xi32>, %arg1: !hlfir.expr<3xi32>) {1431 %c1 = arith.constant 1 : index1432 // expected-error@+1 {{'hlfir.cshift' op SHAPE(ARRAY)(2) must be equal to SHAPE(SHIFT)(1): 2 != 3}}1433 %0 = hlfir.cshift %arg0 %arg1 dim %c1 : (!hlfir.expr<?x2xi32>, !hlfir.expr<3xi32>, index) -> !hlfir.expr<2x2xi32>1434 return1435}1436 1437// -----1438 1439func.func @bad_cshift8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32) {1440 // expected-error@+2 {{'hlfir.cshift' op character KIND mismatch}}1441 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}}1442 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,?>>, i32) -> !hlfir.expr<?x!fir.char<2,?>>1443 return1444}1445 1446// -----1447 1448func.func @bad_cshift9(%arg0: !hlfir.expr<?x!fir.char<1,1>>, %arg1: i32) {1449 // expected-error@+2 {{'hlfir.cshift' op character LEN mismatch}}1450 // expected-error@+1 {{'hlfir.cshift' op input and output arrays should have the same element type}}1451 %0 = hlfir.cshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,1>>, i32) -> !hlfir.expr<?x!fir.char<1,2>>1452 return1453}1454 1455// -----1456 1457func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>) {1458 // expected-error@+1 {{'hlfir.reshape' op ARRAY and the result must have the same element type}}1459 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>) -> !hlfir.expr<?xf32>1460 return1461}1462 1463// -----1464 1465func.func @bad_reshape(%arg0: !hlfir.expr<?x!fir.type<whatever>?>, %arg1: !hlfir.expr<1xi32>) {1466 // expected-error@+1 {{'hlfir.reshape' op ARRAY must be polymorphic iff result is polymorphic}}1467 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<?x!fir.type<whatever>?>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.type<whatever>>1468 return1469}1470 1471// -----1472 1473func.func @bad_reshape(%arg0: !hlfir.expr<?x!fir.type<whatever>>, %arg1: !hlfir.expr<1xi32>) {1474 // expected-error@+1 {{'hlfir.reshape' op ARRAY must be polymorphic iff result is polymorphic}}1475 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<?x!fir.type<whatever>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.type<whatever>?>1476 return1477}1478 1479// -----1480 1481func.func @bad_reshape(%arg0: !hlfir.expr<1x1xi32>) {1482 // expected-error@+1 {{'hlfir.reshape' op SHAPE must be an array of rank 1}}1483 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1x1xi32>, !hlfir.expr<1x1xi32>) -> !hlfir.expr<?xi32>1484 return1485}1486 1487// -----1488 1489func.func @bad_reshape(%arg0: !hlfir.expr<1xf32>) {1490 // expected-error@+1 {{'hlfir.reshape' op SHAPE must be an integer array}}1491 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xf32>, !hlfir.expr<1xf32>) -> !hlfir.expr<?xf32>1492 return1493}1494 1495// -----1496 1497func.func @bad_reshape(%arg0: !hlfir.expr<?xi32>) {1498 // expected-error@+1 {{'hlfir.reshape' op SHAPE must have known size}}1499 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<?xi32>, !hlfir.expr<?xi32>) -> !hlfir.expr<?xi32>1500 return1501}1502 1503// -----1504 1505func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>) {1506 // expected-error@+1 {{'hlfir.reshape' op SHAPE's extent must match the result rank}}1507 %0 = hlfir.reshape %arg0 %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x?xi32>1508 return1509}1510 1511// -----1512 1513func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?xi16>) {1514 // expected-error@+1 {{'hlfir.reshape' op ARRAY and PAD must be of the same type}}1515 %0 = hlfir.reshape %arg0 %arg0 pad %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?xi16>) -> !hlfir.expr<?xi32>1516 return1517}1518 1519// -----1520 1521func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?x?xi16>) {1522 // expected-error@+1 {{'hlfir.reshape' op ORDER must be an array of rank 1}}1523 %0 = hlfir.reshape %arg0 %arg0 order %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?x?xi16>) -> !hlfir.expr<?xi32>1524 return1525}1526 1527// -----1528 1529func.func @bad_reshape(%arg0: !hlfir.expr<1xi32>, %arg1: !hlfir.expr<?xf16>) {1530 // expected-error@+1 {{'hlfir.reshape' op ORDER must be an integer array}}1531 %0 = hlfir.reshape %arg0 %arg0 order %arg1 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !hlfir.expr<?xf16>) -> !hlfir.expr<?xi32>1532 return1533}1534 1535// -----1536 1537func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) {1538 // expected-error@+1 {{'hlfir.reshape' op operand #0 must be any array-like entity}}1539 %0 = hlfir.reshape %arg0 %arg1 : (!fir.ref<!fir.array<?xi32>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?xi32>1540 return1541}1542 1543// -----1544 1545func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<?xi32>) {1546 // expected-error@+1 {{'hlfir.reshape' op operand #1 must be any array-like entity containing a numerical type}}1547 %0 = hlfir.reshape %arg1 %arg0 : (!hlfir.expr<?xi32>, !fir.ref<!fir.array<?xi32>>) -> !hlfir.expr<?xi32>1548 return1549}1550 1551// -----1552 1553func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) {1554 // expected-error@+1 {{'hlfir.reshape' op operand #2 must be any array-like entity}}1555 %0 = hlfir.reshape %arg1 %arg1 pad %arg0 : (!hlfir.expr<1xi32>, !hlfir.expr<1xi32>, !fir.ref<!fir.array<?xi32>>) -> !hlfir.expr<?xi32>1556 return1557}1558 1559// -----1560 1561func.func @bad_reshape(%arg0: !fir.ref<!fir.array<?xi32>>, %arg1: !hlfir.expr<1xi32>) {1562 // expected-error@+1 {{'hlfir.reshape' op operand #3 must be any array-like entity containing a numerical type}}1563 %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>1564 return1565}1566 1567// -----1568 1569func.func @bad_reshape(%arg0: !hlfir.expr<1x!fir.char<1,2>>, %arg1: !hlfir.expr<1xi32>) {1570 // expected-error@+2 {{'hlfir.reshape' op character KIND mismatch}}1571 // expected-error@+1 {{'hlfir.reshape' op ARRAY and the result must have the same element type}}1572 %0 = hlfir.reshape %arg0 %arg1 : (!hlfir.expr<1x!fir.char<1,2>>, !hlfir.expr<1xi32>) -> !hlfir.expr<?x!fir.char<2,?>>1573 return1574}1575 1576// -----1577 1578func.func @bad_reshape(%arg0: !hlfir.expr<1x!fir.char<1,2>>, %arg1: !hlfir.expr<1xi32>, %arg2: !hlfir.expr<1x!fir.char<2,?>>) {1579 // expected-error@+2 {{'hlfir.reshape' op character KIND mismatch}}1580 // expected-error@+1 {{'hlfir.reshape' op ARRAY and PAD must be of the same type}}1581 %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,?>>1582 return1583}1584 1585// -----1586 1587func.func @bad_eoshift1(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) {1588 // expected-error@+1 {{'hlfir.eoshift' op input and output arrays should have the same element type}}1589 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?x?xf32>1590 return1591}1592 1593// -----1594 1595func.func @bad_eoshift2(%arg0: !hlfir.expr<?x?xi32>, %arg1: i32) {1596 // expected-error@+1 {{'hlfir.eoshift' op input and output arrays should have the same rank}}1597 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<?x?xi32>, i32) -> !hlfir.expr<?xi32>1598 return1599}1600 1601// -----1602 1603func.func @bad_eoshift3(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1604 // expected-error@+1 {{'hlfir.eoshift' op output array's shape conflicts with the input array's shape}}1605 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, i32) -> !hlfir.expr<2x3xi32>1606 return1607}1608 1609// -----1610 1611func.func @bad_eoshift4(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1612 %c0 = arith.constant 0 : index1613 // expected-error@+1 {{'hlfir.eoshift' op DIM must be >= 1}}1614 %0 = hlfir.eoshift %arg0 %arg1 dim %c0 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32>1615 return1616}1617 1618// -----1619 1620func.func @bad_eoshift5(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32) {1621 %c10 = arith.constant 10 : index1622 // expected-error@+1 {{'hlfir.eoshift' op DIM must be <= input array's rank}}1623 %0 = hlfir.eoshift %arg0 %arg1 dim %c10 : (!hlfir.expr<2x2xi32>, i32, index) -> !hlfir.expr<2x2xi32>1624 return1625}1626 1627// -----1628 1629func.func @bad_eoshift6(%arg0: !hlfir.expr<2x2xi32>, %arg1: !hlfir.expr<2x2xi32>) {1630 // expected-error@+1 {{'hlfir.eoshift' op SHIFT's rank must be 1 less than the input array's rank}}1631 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<2x2xi32>, !hlfir.expr<2x2xi32>) -> !hlfir.expr<2x2xi32>1632 return1633}1634 1635// -----1636 1637func.func @bad_eoshift7(%arg0: !hlfir.expr<?x2xi32>, %arg1: !hlfir.expr<3xi32>) {1638 %c1 = arith.constant 1 : index1639 // expected-error@+1 {{'hlfir.eoshift' op SHAPE(ARRAY)(2) must be equal to SHAPE(SHIFT)(1): 2 != 3}}1640 %0 = hlfir.eoshift %arg0 %arg1 dim %c1 : (!hlfir.expr<?x2xi32>, !hlfir.expr<3xi32>, index) -> !hlfir.expr<2x2xi32>1641 return1642}1643 1644// -----1645 1646func.func @bad_eoshift8(%arg0: !hlfir.expr<?x!fir.char<1,?>>, %arg1: i32) {1647 // expected-error@+2 {{'hlfir.eoshift' op character KIND mismatch}}1648 // expected-error@+1 {{'hlfir.eoshift' op input and output arrays should have the same element type}}1649 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,?>>, i32) -> !hlfir.expr<?x!fir.char<2,?>>1650 return1651}1652 1653// -----1654 1655func.func @bad_eoshift9(%arg0: !hlfir.expr<?x!fir.char<1,1>>, %arg1: i32) {1656 // expected-error@+2 {{'hlfir.eoshift' op character LEN mismatch}}1657 // expected-error@+1 {{'hlfir.eoshift' op input and output arrays should have the same element type}}1658 %0 = hlfir.eoshift %arg0 %arg1 : (!hlfir.expr<?x!fir.char<1,1>>, i32) -> !hlfir.expr<?x!fir.char<1,2>>1659 return1660}1661 1662// -----1663 1664func.func @bad_eoshift10(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32, %arg2: f32) {1665 // expected-error@+1 {{'hlfir.eoshift' op ARRAY and BOUNDARY operands must have the same element type}}1666 %0 = hlfir.eoshift %arg0 %arg1 boundary %arg2 : (!hlfir.expr<2x2xi32>, i32, f32) -> !hlfir.expr<2x2xi32>1667 return1668}1669 1670// -----1671 1672func.func @bad_eoshift11(%arg0: !hlfir.expr<2x2xi32>, %arg1: i32, %arg2: !hlfir.expr<2x2xi32>) {1673 // expected-error@+1 {{'hlfir.eoshift' op BOUNDARY's rank must be 1 less than the input array's rank}}1674 %0 = hlfir.eoshift %arg0 %arg1 boundary %arg2 : (!hlfir.expr<2x2xi32>, i32, !hlfir.expr<2x2xi32>) -> !hlfir.expr<2x2xi32>1675 return1676}1677 1678// -----1679 1680func.func @fir_declare_bad_storage_offset(%arg0: !fir.ref<!fir.array<8xi8>>) {1681 %c0 = arith.constant 0 : index1682 %addr = fir.address_of(@block_) : !fir.ref<!fir.array<8xi8>>1683 %2 = fir.convert %addr : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>1684 %var = fir.coordinate_of %2, %c0 : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>1685 // expected-error@+1 {{negative integer literal not valid for unsigned integer type}}1686 %decl:2 = hlfir.declare %var storage (%addr[-1]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<!fir.array<8xi8>>) -> (!fir.ref<i8>, !fir.ref<i8>)1687 return1688}1689 1690// -----1691 1692"func.func"() <{function_type = (!fir.ref<!fir.array<8xi8>>) -> (), sym_name = "fir_declare_bad_storage_offset"}> ({1693^bb0(%arg0: !fir.ref<!fir.array<8xi8>>):1694 %0 = "arith.constant"() <{value = 0 : index}> : () -> index1695 %1 = "fir.address_of"() <{symbol = @block_}> : () -> !fir.ref<!fir.array<8xi8>>1696 %2 = "fir.convert"(%1) : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>1697 %3 = "fir.coordinate_of"(%2, %0) <{baseType = !fir.ref<!fir.array<?xi8>>}> : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>1698// expected-error@+1 {{storage offset specified without the storage reference}}1699 %4:2 = "hlfir.declare"(%3) <{operandSegmentSizes = array<i32: 1, 0, 0, 0, 0>, storage_offset = 1 : ui64, uniq_name = "a"}> : (!fir.ref<i8>) -> (!fir.ref<i8>, !fir.ref<i8>)1700 "func.return"() : () -> ()1701}) : () -> ()1702