Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / equivalence-static-init.f90
blob6b4b0ccff4c5e6679c8aaef623c3bf42771c548f
1 ! RUN: bbc -emit-fir -o - %s | FileCheck %s
3 ! Test explicit static initialization of equivalence storage
5 module module_without_init
6 real :: x(2)
7 integer :: i(2)
8 equivalence(i(1), x)
9 end module
10 ! CHECK-LABEL: fir.global @_QMmodule_without_initEi : !fir.array<8xi8> {
11 ! CHECK: %0 = fir.undefined !fir.array<8xi8>
12 ! CHECK: fir.has_value %0 : !fir.array<8xi8>
13 ! CHECK}
16 subroutine test_eqv_init
17 integer, save :: link(3)
18 integer :: i = 5
19 integer :: j = 7
20 equivalence (j, link(1))
21 equivalence (i, link(3))
22 end subroutine
24 ! CHECK-LABEL: fir.global internal @_QFtest_eqv_initEi : !fir.array<3xi32> {
25 ! CHECK: %[[VAL_1:.*]] = fir.undefined !fir.array<3xi32>
26 ! CHECK: %[[VAL_2:.*]] = fir.insert_value %0, %c7{{.*}}, [0 : index] : (!fir.array<3xi32>, i32) -> !fir.array<3xi32>
27 ! CHECK: %[[VAL_3:.*]] = fir.insert_value %1, %c0{{.*}}, [1 : index] : (!fir.array<3xi32>, i32) -> !fir.array<3xi32>
28 ! CHECK: %[[VAL_4:.*]] = fir.insert_value %2, %c5{{.*}}, [2 : index] : (!fir.array<3xi32>, i32) -> !fir.array<3xi32>
29 ! CHECK: fir.has_value %[[VAL_4]] : !fir.array<3xi32>
30 ! CHECK: }