summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/equiv_4.f90
blob: 9c232786dbb19c68fad387cfda3bda67d05476af (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
      subroutine test1
      character*8 c
      character*2 d, f
      dimension d(2), f(2)
      character*4 e
      equivalence (c(1:1), d(1)(2:)), (c(3:5), e(2:4))
      equivalence (c(6:6), f(2)(:))
      d(1)='AB'
      c='abcdefgh'
      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') call abort
      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') call abort
      end subroutine test1
      subroutine test2
      equivalence (c(1:1), d(1)(2:2)), (c(3:5), e(2:4))
      equivalence (c(6:6), f(2)(1:))
      character*8 c
      character*2 d, f
      dimension d(2), f(2)
      character*4 e
      d(1)='AB'
      c='abcdefgh'
      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') call abort
      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') call abort
      end subroutine test2
      subroutine test3
      character*8 c
      character*2 d, f
      character*4 e
      equivalence (c(1:1), d(1)(2:)), (c(3:5), e(2:4))
      equivalence (c(6:6), f(2)(:1))
      dimension d(2), f(2)
      d(1)='AB'
      c='abcdefgh'
      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') call abort
      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') call abort
      end subroutine test3
      subroutine test4
      dimension d(2), f(2)
      equivalence (c(1:1), d(1)(2:2)), (c(3:5), e(2:4))
      equivalence (c(6:6), f(2)(1:2))
      character*8 c
      character*2 d, f
      character*4 e
      d(1)='AB'
      c='abcdefgh'
      if (c.ne.'abcdefgh'.or.d(1).ne.'Aa'.or.d(2).ne.'bc') call abort
      if (e.ne.'bcde'.or.f(1).ne.'de'.or.f(2).ne.'fg') call abort
      end subroutine test4
      program main
      call test1
      call test2
      call test3
      call test4
      end program main