aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pdt_23.f03
blob: b2156b9ce6ee1a4ae78eb614eff763b57460ad32 (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
! { dg-do run }
!
! Tests the fixes for PR82719 and PR82720.
!
! Contributed by Gerhard Steinmetz  <gscfq@t-online.de>
!
program p
   character(120) :: buffer
   character(3) :: chr
   integer :: i
   type t(a)
      integer, len :: a
      character(len=a) :: c
   end type
   type(t(:)), allocatable :: x
   allocate (t(2) :: x)

   x = t(2,'ab')
   write (buffer, *) x%c ! Tests the fix for PR82720
   read (buffer, *) chr
   if (trim (chr) .ne. 'ab') STOP 1

   x = t(3,'xyz')
   if (len (x%c) .ne. 3) STOP 2
   write (buffer, *) x   ! Tests the fix for PR82719
   read (buffer, *) i, chr
   if (i .ne. 3) STOP 3
   if (chr .ne. 'xyz') STOP 4

   buffer = " 3  lmn"
   read (buffer, *) x   ! Some thought will be needed for PDT reads.
   if (x%c .ne. 'lmn') STOP 5
end