summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/complex_read.f90
blob: 102a13522f9d910bcec2119a82f712491802700c (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
! { dg-do run { target fd_truncate } }
! Test of the fix to the bug in NIST fm906.for.
! Contributed by Paul Thomas  <pault@gcc.gnu.org>
!
program complex_read
  complex            ::  a
  open (10, status="scratch")

! Test that we have not broken the one line form.

  write (10, *) " ( 0.99  ,  9.9  )"
  rewind (10)
  read (10,*) a
  if (a.ne.(0.99, 9.90)) call abort ()

! Test a new record after the.comma (the original bug).

  rewind (10)
  write (10, *) " ( 99.0   ,"
  write (10, *) "   999.0  )"
  rewind (10)
  read (10,*) a
  if (a.ne.(99.0, 999.0)) call abort ()

! Test a new record before the.comma 

  rewind (10)
  write (10, *) " ( 0.99  "
  write (10, *) " , 9.9  )"
  rewind (10)
  read (10,*) a
  if (a.ne.(0.99, 9.90)) call abort ()

! Test a new records before and after the.comma 

  rewind (10)
  write (10, *) " ( 99.0   "
  write (10, *) ",         "
  write (10, *) "  999.0  )"
  rewind (10)
  read (10,*) a
  if (a.ne.(99.0, 999.0)) call abort ()

! Test a new records and blank records before and after the.comma 

  rewind (10)
  write (10, *) " ( 0.99   "
  write (10, *) "          "
  write (10, *) ",         "
  write (10, *) "          "
  write (10, *) "  9.9    )"
  rewind (10)
  read (10,*) a
  if (a.ne.(0.99, 9.9)) call abort ()

  close (10)
end program complex_read