1! { dg-do run }
2! Test the fix for PR47348, in which the substring length
3! in the array constructor at line 19 would be missed and
4! the length of q used instead.
5!
6! Contributed by Thomas Koenig  <tkoenig@netcologne.de>
7!
8program main
9  implicit none
10  character(len = *), parameter :: fmt='(2(A,"|"))'
11  character(len = *), parameter :: test='xyc|aec|'
12  integer :: i
13  character(len = 4) :: q
14  character(len = 8) :: buffer
15  q = 'xy'
16  i = 2
17  write (buffer, fmt) (/ trim(q), 'ae' /)//'c'
18  if (buffer .ne. test) Call abort
19  write (buffer, FMT) (/ q(1:i), 'ae' /)//'c'
20  if (buffer .ne. test) Call abort
21end program main
22