[ConstraintElim] Add support for decomposing gep nuw (#118639)
[llvm-project.git] / flang / test / Lower / common-block-2.f90
blob635a1597b1033162cce7e6cc866c9939f8a32062
1 ! RUN: bbc %s -o - | FileCheck %s
3 ! Test support of non standard features regarding common blocks:
4 ! - A named common that appears with different storage sizes
5 ! - A blank common that is initialized
6 ! - A common block that is initialized outside of a BLOCK DATA.
8 ! CHECK-LABEL: fir.global @__BLNK__ {alignment = 4 : i64} : tuple<i32, !fir.array<8xi8>> {
9 ! CHECK: %[[undef:.*]] = fir.zero_bits tuple<i32, !fir.array<8xi8>>
10 ! CHECK: %[[init:.*]] = fir.insert_value %[[undef]], %c42{{.*}}, [0 : index] : (tuple<i32, !fir.array<8xi8>>, i32) -> tuple<i32, !fir.array<8xi8>>
11 ! CHECK: fir.has_value %[[init]] : tuple<i32, !fir.array<8xi8>>
13 ! CHECK-LABEL: fir.global @a_ {alignment = 4 : i64} : tuple<i32, !fir.array<8xi8>> {
14 ! CHECK: %[[undef:.*]] = fir.zero_bits tuple<i32, !fir.array<8xi8>>
15 ! CHECK: %[[init:.*]] = fir.insert_value %[[undef]], %c42{{.*}}, [0 : index] : (tuple<i32, !fir.array<8xi8>>, i32) -> tuple<i32, !fir.array<8xi8>>
16 ! CHECK: fir.has_value %[[init]] : tuple<i32, !fir.array<8xi8>>
19 subroutine first_appearance
20 real :: x, y, xa, ya
21 common // x, y
22 common /a/ xa, ya
23 call foo(x, xa)
24 end subroutine
26 subroutine second_appearance
27 real :: x, y, z, xa, ya, za
28 common // x, y, z
29 common /a/ xa, ya, za
30 call foo(x, xa)
31 end subroutine
33 subroutine third_appearance
34 integer :: x = 42, xa = 42
35 common // x
36 common /a/ xa
37 end subroutine