1 // RUN: fir-opt --split-input-file --verify-diagnostics %s
3 func.func @_QPcoordinate_box_derived_with_fir_len(%arg0: !fir.box<!fir.type<derived_2{len1:i32}>>) -> i32 {
4 %lp = arith.constant 22 : i32
5 %e = fir.len_param_index len1, !fir.type<derived_1{len1:i32}>(%lp : i32)
6 // expected-error@+1 {{'fir.coordinate_of' op len_param_index type not compatible with reference type}}
7 %q = fir.coordinate_of %arg0, %e : (!fir.box<!fir.type<derived_2{len1:i32}>>, !fir.len) -> !fir.ref<i32>
8 %val = fir.load %q : !fir.ref<i32>
14 func.func @_QPcoordinate_box_derived_with_fir_len2(%arg0: !fir.box<!fir.array<?x!fir.type<derived_2{len1:i32}>>>) -> i32 {
15 %lp = arith.constant 22 : i32
16 %e = fir.len_param_index len1, !fir.type<derived_1{len1:i32}>(%lp : i32)
17 // expected-error@+1 {{'fir.coordinate_of' op too many operands for len_param_index case}}
18 %q = fir.coordinate_of %arg0, %lp, %e : (!fir.box<!fir.array<?x!fir.type<derived_2{len1:i32}>>>, i32, !fir.len) -> !fir.ref<i32>
19 %val = fir.load %q : !fir.ref<i32>
25 func.func @_QPcoordinate_box_derived_with_fir_len3(%arg0: !fir.box<!fir.type<derived_2{len1:i32}>>) -> i32 {
26 %lp = arith.constant 22 : i32
27 %e = fir.len_param_index len1, !fir.type<derived_1{len1:i32}>(%lp : i32)
28 // expected-error@+1 {{'fir.coordinate_of' op len_param_index must be last argument}}
29 %q = fir.coordinate_of %arg0, %e, %e : (!fir.box<!fir.type<derived_2{len1:i32}>>, !fir.len, !fir.len) -> !fir.ref<i32>
30 %val = fir.load %q : !fir.ref<i32>
36 func.func @_QPtest_coordinate_of(%arr : !fir.ref<!fir.array<2 x !fir.char<10, 2>>>, %arg1: index) {
37 %1 = arith.constant 10 : i32
38 // expected-error@+1 {{'fir.coordinate_of' op character type mismatch}}
39 %2 = fir.coordinate_of %arr, %arg1, %1 : (!fir.ref<!fir.array<2 x !fir.char<10, 2>>>, index, i32) -> !fir.ref<!fir.char<1,10>>
45 func.func @_QPtest_coordinate_of(%arr : !fir.ref<!fir.array<2 x i32>>, %arg1: index) {
46 // expected-error@+1 {{'fir.coordinate_of' op invalid parameters (too many)}}
47 %2 = fir.coordinate_of %arr, %arg1, %arg1 : (!fir.ref<!fir.array<2 x i32>>, index, index) -> !fir.ref<i32>