1 ! RUN: bbc -o - %s | FileCheck %s
3 ! CHECK-LABEL: func @_QPs1
7 ! CHECK: = fir.alloca !fir.array<4xi8> {uniq_name = "_QFs1Ei"}
9 ! CHECK: %[[coor:.*]] = fir.coordinate_of %{{.*}}, %{{.*}} : (!fir.ref<!fir.array<4xi8>>, index) -> !fir.ref<i8>
10 ! CHECK: %[[iloc:.*]] = fir.convert %[[coor]] : (!fir.ref<i8>) -> !fir.ptr<i32>
11 ! CHECK-DAG: fir.store %{{.*}} to %[[iloc]] : !fir.ptr<i32>
13 ! CHECK-DAG: %[[floc:.*]] = fir.convert %[[coor]] : (!fir.ref<i8>) -> !fir.ptr<f32>
14 ! CHECK: %[[ld:.*]] = fir.load %[[floc]] : !fir.ptr<f32>
18 ! CHECK-LABEL: func @_QPs2
22 ! CHECK: %[[arr:.*]] = fir.alloca !fir.array<48xi8>
23 EQUIVALENCE (r(3),i(5))
24 ! CHECK: %[[iarr:.*]] = fir.convert %{{.*}} : (!fir.ref<i8>) -> !fir.ptr<!fir.array<10xi32>>
25 ! CHECK: %[[foff:.*]] = fir.coordinate_of %[[arr]], %{{.*}} : (!fir.ref<!fir.array<48xi8>>, index) -> !fir.ref<i8>
26 ! CHECK: %[[farr:.*]] = fir.convert %[[foff]] : (!fir.ref<i8>) -> !fir.ptr<!fir.array<10xf32>>
27 ! CHECK: %[[ia:.*]] = fir.coordinate_of %[[iarr]], %{{.*}} : (!fir.ptr<!fir.array<10xi32>>, i64) -> !fir.ref<i32>
28 ! CHECK: fir.store %{{.*}} to %[[ia]] : !fir.ref<i32>
30 ! CHECK: %[[fld:.*]] = fir.coordinate_of %[[farr]], %{{.*}} : (!fir.ptr<!fir.array<10xf32>>, i64) -> !fir.ref<f32>
31 ! CHECK: = fir.load %[[fld]] : !fir.ref<f32>
35 ! CHECK-LABEL: func @_QPs3
43 ! CHECK: %[[group:.*]] = fir.alloca !fir.array<40xi8>
45 ! CHECK: %[[coor:.*]] = fir.coordinate_of %[[group]], %c0 : (!fir.ref<!fir.array<40xi8>>, index) -> !fir.ref<i8>
46 ! CHECK: %[[rloc:.*]] = fir.convert %[[coor]] : (!fir.ref<i8>) -> !fir.ptr<!fir.array<10xf32>>
47 ! CHECK: %[[xloc:.*]] = fir.convert %[[coor]] : (!fir.ref<i8>) -> !fir.ptr<!fir.type<_QFs3Tt{r:!fir.array<10xf32>}>>
48 ! CHECK: %[[fidx:.*]] = fir.field_index r, !fir.type<_QFs3Tt{r:!fir.array<10xf32>}>
49 ! CHECK: %[[xrloc:.*]] = fir.coordinate_of %[[xloc]], %[[fidx]] :
50 ! CHECK: %[[v1loc:.*]] = fir.coordinate_of %[[xrloc]], %c8_i64 : (!fir.ref<!fir.array<10xf32>>, i64) -> !fir.ref<f32>
51 ! CHECK: fir.store %{{.*}} to %[[v1loc]] : !fir.ref<f32>
53 ! CHECK: %[[v2loc:.*]] = fir.coordinate_of %[[rloc]], %c8_i64 : (!fir.ptr<!fir.array<10xf32>>, i64) -> !fir.ref<f32>
54 ! CHECK: %{{.*}} = fir.load %[[v2loc]] : !fir.ref<f32>
58 ! test that equivalence in main program containing arrays are placed in global memory.
59 ! CHECK: fir.global internal @_QFEa : !fir.array<400000000xi8>
60 integer :: a
, b(100000000)