Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / offsets03.f90
blob9d2716db7fc50b254710a7eb3f132bbdfaf9da54
1 !RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
3 ! Size and alignment with EQUIVALENCE and COMMON
5 ! a1 depends on a2 depends on a3
6 module ma
7 real :: a1(10), a2(10), a3(10)
8 equivalence(a1, a2(3)) !CHECK: a1, PUBLIC size=40 offset=20:
9 equivalence(a2, a3(4)) !CHECK: a2, PUBLIC size=40 offset=12:
10 !CHECK: a3, PUBLIC size=40 offset=0:
11 end
13 ! equivalence and 2-dimensional array
14 module mb
15 real :: b1(4), b2, b3, b4
16 real :: b(-1:1,2:6) !CHECK: b, PUBLIC size=60 offset=0:
17 equivalence(b(1,6), b1) !CHECK: b1, PUBLIC size=16 offset=56:
18 equivalence(b(1,5), b2) !CHECK: b2, PUBLIC size=4 offset=44:
19 equivalence(b(0,6), b3) !CHECK: b3, PUBLIC size=4 offset=52:
20 equivalence(b(0,4), b4) !CHECK: b4, PUBLIC size=4 offset=28:
21 end
23 ! equivalence and substring
24 subroutine mc !CHECK: Subprogram scope: mc size=12 alignment=1
25 character(10) :: c1 !CHECK: c1 size=10 offset=0:
26 character(5) :: c2 !CHECK: c2 size=5 offset=7:
27 equivalence(c1(9:), c2(2:4))
28 end
30 ! Common block: objects are in order from COMMON statement and not part of module
31 module md !CHECK: Module scope: md size=1 alignment=1
32 integer(1) :: i
33 integer(2) :: d1 !CHECK: d1, PUBLIC size=2 offset=8:
34 integer(4) :: d2 !CHECK: d2, PUBLIC size=4 offset=4:
35 integer(1) :: d3 !CHECK: d3, PUBLIC size=1 offset=0:
36 real(2) :: d4 !CHECK: d4, PUBLIC size=2 offset=0:
37 common /common1/ d3,d2,d1 !CHECK: common1 size=10 offset=0: CommonBlockDetails alignment=4:
38 common /common2/ d4 !CHECK: common2 size=2 offset=0: CommonBlockDetails alignment=2:
39 end
41 ! Test extension of common block size through equivalence statements.
42 module me
43 integer :: i1, j1, l1(10)
44 equivalence(i1, l1)
45 common /common3/ j1, i1 ! CHECK: common3 size=44 offset=0: CommonBlockDetails alignment=4:
47 integer :: i2, j2, l2(10)
48 equivalence(i2, l2(2))
49 common /common4/ j2, i2 ! CHECK: common4 size=40 offset=0: CommonBlockDetails alignment=4:
51 integer :: i3, j3, l3(10)
52 equivalence(i3, l3)
53 common /common5/ i3, j3 ! CHECK: common5 size=40 offset=0: CommonBlockDetails alignment=4:
55 integer :: i4, j4, l4(10), k4(10)
56 equivalence(i4, l4)
57 equivalence(l4(10), k4)
58 common /common6/ i4, j4 ! CHECK: common6 size=76 offset=0: CommonBlockDetails alignment=4:
60 integer :: i5, j5, l5(10)
61 equivalence(l5(1), i5)
62 common /common7/ j5, i5 ! CHECK: common7 size=44 offset=0: CommonBlockDetails alignment=4:
64 real :: a1, a2, a3(2)
65 equivalence(a1,a3(1)),(a2,a3(2))
66 common /common8/ a1, a2 ! CHECK: common8 size=8 offset=0: CommonBlockDetails alignment=4:
67 end