File: offsets03.f90

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (39 lines) | stat: -rw-r--r-- 1,612 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s

! Size and alignment with EQUIVALENCE and COMMON

! a1 depends on a2 depends on a3
module ma
  real :: a1(10), a2(10), a3(10)
  equivalence(a1, a2(3)) !CHECK: a1, PUBLIC size=40 offset=20:
  equivalence(a2, a3(4)) !CHECK: a2, PUBLIC size=40 offset=12:
  !CHECK: a3, PUBLIC size=40 offset=0:
end

! equivalence and 2-dimensional array
module mb
  real :: b1(4), b2, b3, b4
  real :: b(-1:1,2:6)     !CHECK: b, PUBLIC size=60 offset=0:
  equivalence(b(1,6), b1) !CHECK: b1, PUBLIC size=16 offset=56:
  equivalence(b(1,5), b2) !CHECK: b2, PUBLIC size=4 offset=44:
  equivalence(b(0,6), b3) !CHECK: b3, PUBLIC size=4 offset=52:
  equivalence(b(0,4), b4) !CHECK: b4, PUBLIC size=4 offset=28:
end

! equivalence and substring
subroutine mc         !CHECK: Subprogram scope: mc size=12 alignment=1
  character(10) :: c1 !CHECK: c1 size=10 offset=0:
  character(5)  :: c2 !CHECK: c2 size=5 offset=7:
  equivalence(c1(9:), c2(2:4))
end

! Common block: objects are in order from COMMON statement and not part of module
module md                   !CHECK: Module scope: md size=1 alignment=1
  integer(1) :: i 
  integer(2) :: d1          !CHECK: d1, PUBLIC size=2 offset=8:
  integer(4) :: d2          !CHECK: d2, PUBLIC size=4 offset=4:
  integer(1) :: d3          !CHECK: d3, PUBLIC size=1 offset=0:
  real(2) :: d4             !CHECK: d4, PUBLIC size=2 offset=0:
  common /common1/ d3,d2,d1 !CHECK: common1 size=10 offset=0: CommonBlockDetails alignment=4:
  common /common2/ d4       !CHECK: common2 size=2 offset=0: CommonBlockDetails alignment=2:
end