| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-O -fdump-tree-original" } |
| 3 |
! PR 47065 - replace trim with substring expressions even with references. |
| 4 |
program main |
| 5 |
implicit none |
| 6 |
type t |
| 7 |
character(len=2) :: x |
| 8 |
end type t |
| 9 |
type(t) :: a |
| 10 |
character(len=3) :: b |
| 11 |
character(len=10) :: line |
| 12 |
a%x = 'a' |
| 13 |
write(unit=line,fmt='(A,A)') trim(a%x),"X" |
| 14 |
if (line /= 'aX ') STOP 1 |
| 15 |
b = 'ab' |
| 16 |
write (unit=line,fmt='(A,A)') trim(b),"Y" |
| 17 |
if (line /= 'abY ') STOP 2 |
| 18 |
end program main |
| 19 |
! { dg-final { scan-tree-dump-times "string_len_trim" 2 "original" } } |