summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_35.f90
blob: 67329785bc4315fe086f05a4e2163f4fa912687f (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
! { dg-do run }
!
! Test the fix for PR84115 comment #1.
!
! Contributed by G Steinmetz  <gscfq@t-online.de>
!
  character(:), allocatable :: dum
  dum = "s1"
  call s1 (dum)
  dum = "s2"
  call s2 (dum)
  dum = "s3"
  call s3 (dum)
contains
  subroutine s1(x)
    character(:), allocatable :: x
    associate (y => x//x)
      if (y .ne. x//x) stop 1
    end associate
  end

  subroutine s2(x)
    character(:), allocatable :: x
    associate (y => [x])
      if (any(y .ne. [x])) stop 2
    end associate
  end

  subroutine s3(x)
    character(:), allocatable :: x
    associate (y => [x,x])
      if (any(y .ne. [x,x])) stop 3
    end associate
  end
end