summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_22.f90
blob: 35daf89098df9f14c53c14bb5e6e1d8acc2d0152 (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
! { dg-do run }
program foo

   implicit none

   character(len=4) :: s
   character(len=10) :: a

   ! This works.
   s = 'abc'
   associate(t => s)
      if (trim(t) /= 'abc') STOP 1
   end associate

   ! This failed.
   associate(u => 'abc')
      if (trim(u) /= 'abc') STOP 2
   end associate

   ! This failed.
   a = s // 'abc'
   associate(v => s // 'abc')
      if (trim(v) /= trim(a)) STOP 3
   end associate

   ! This failed.
   a = trim(s) // 'abc'
   associate(w => trim(s) // 'abc')
      if (trim(w) /= trim(a)) STOP 4
   end associate

   ! This failed.
   associate(x => trim('abc'))
      if (trim(x) /= 'abc') STOP 5
   end associate

end program foo