summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/trim_optimize_7.f90
blob: 3c1e29ba24ca23910dd9ca9e257a7ba3fb827445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
! { dg-do run }
! { dg-options "-O -fdump-tree-original" }
! Check that trailing trims are also removed from assignment of
! expressions involving concatenations of strings .
program main
  character(2) :: a,b,c
  character(8) :: d
  a = 'a '
  b = 'b '
  c = 'c '
  d = a // b // a // trim(c)   ! This should be optimized away.
  if (d /= 'a b a c ') STOP 1
  d = a // trim(b) // c // a   ! This shouldn't.
  if (d /= 'a bc a  ') STOP 2
  d = a // b // a // trim(trim(c)) ! This should also be optimized away.
  if (d /= 'a b a c ') STOP 3
end
! { dg-final { scan-tree-dump-times "string_len_trim" 1 "original" } }