1      subroutine test1
2      character*8 c
3      character*2 d, f
4      dimension d(2), f(2)
5      character*4 e
6      equivalence (c(1:1), d(1)(2:)), (c(3:5), e(2:4))
7      equivalence (c(6:6), f(2)(:))
8      d(1)='AB'
9      c='abcdefgh'
10      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') STOP 1
11      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') STOP 2
12      end subroutine test1
13      subroutine test2
14      equivalence (c(1:1), d(1)(2:2)), (c(3:5), e(2:4))
15      equivalence (c(6:6), f(2)(1:))
16      character*8 c
17      character*2 d, f
18      dimension d(2), f(2)
19      character*4 e
20      d(1)='AB'
21      c='abcdefgh'
22      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') STOP 3
23      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') STOP 4
24      end subroutine test2
25      subroutine test3
26      character*8 c
27      character*2 d, f
28      character*4 e
29      equivalence (c(1:1), d(1)(2:)), (c(3:5), e(2:4))
30      equivalence (c(6:6), f(2)(:1))
31      dimension d(2), f(2)
32      d(1)='AB'
33      c='abcdefgh'
34      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') STOP 5
35      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') STOP 6
36      end subroutine test3
37      subroutine test4
38      dimension d(2), f(2)
39      equivalence (c(1:1), d(1)(2:2)), (c(3:5), e(2:4))
40      equivalence (c(6:6), f(2)(1:2))
41      character*8 c
42      character*2 d, f
43      character*4 e
44      d(1)='AB'
45      c='abcdefgh'
46      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') STOP 7
47      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') STOP 8
48      end subroutine test4
49      program main
50      call test1
51      call test2
52      call test3
53      call test4
54      end program main
55