summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/widechar_IO_3.f90
blob: c09205e2d7d349a5e0fa364c1607dd841a85c99c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { dg-do run { target fd_truncate } }
! Wide character I/O test 3, unformatted arrays
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test1
  integer, parameter :: k4 = 4
  character(len=10,kind=4) :: wide
  character(len=10,kind=4), dimension(5,7) :: widearray
  wide = k4_"abcdefg"
  widearray = k4_"1234abcd"
  open(10, form="unformatted", status="scratch")
  write(10) wide
  rewind(10)
  wide = "wrong"
  read(10) wide
  if (wide /= k4_"abcdefg") call abort
  rewind(10)
  write(10) widearray(2:4,3:7)
  widearray(2:4,3:7)=""
  rewind(10)
  read(10) widearray(2:4,3:7)
  close(10)
  if (any(widearray.ne.k4_"1234abcd")) call abort
end program test1