libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gfortran.dg / unf_io_convert_2.f90
blobf29f6ee249e89f39e2cac6cab6c60d7c533ba881
1 ! { dg-do run }
2 program main
3 complex(kind=4) :: c
4 real(kind=4) :: a(2)
5 integer(kind=4) :: i(2)
6 integer(kind=1) :: b(8)
7 integer(kind=8) :: j
9 c = (3.14, 2.71)
10 open (10, form="unformatted",convert="swap") ! { dg-warning "Extension: CONVERT" }
11 write (10) c
12 rewind (10)
13 read (10) a
14 if (a(1) /= 3.14 .or. a(2) /= 2.71) call abort
15 close(10,status="delete")
17 open (10, form="unformatted",convert="big_endian") ! { dg-warning "Extension: CONVERT" }
18 i = (/ Z'11223344', Z'55667700' /)
19 write (10) i
20 rewind (10)
21 read (10) b
22 if (any(b /= (/ Z'11', Z'22', Z'33', Z'44', Z'55', Z'66', Z'77', Z'00' /))) &
23 call abort
24 backspace 10
25 read (10) j
26 if (j /= Z'1122334455667700') call abort
27 close (10, status="delete")
29 open (10, form="unformatted", convert="little_endian") ! { dg-warning "Extension: CONVERT" }
30 write (10) i
31 rewind (10)
32 read (10) b
33 if (any(b /= (/ Z'44', Z'33', Z'22', Z'11', Z'00', Z'77', Z'66', Z'55' /))) &
34 call abort
35 backspace 10
36 read (10) j
37 if (j /= Z'5566770011223344') call abort
38 close (10, status="delete")
40 end program main