OSDN Git Service

2008-02-21 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / io_constraints_1.f90
1 ! { dg-do compile }
2 ! { dg-options "-std=f95" }
3 ! Part I of the test  of the IO constraints patch, which fixes PRs:
4 ! PRs 25053, 25063, 25064, 25066, 25067, 25068, 25069, 25307 and 20862.
5 !
6 ! Contributed by Paul Thomas  <pault@gcc.gnu.org>
7 !
8 module fails
9
10  2000 format (1h , 2i6)                        ! { dg-error "Format statement in module" }
11
12 end module fails
13
14 module global
15
16   integer :: modvar
17   namelist /NL/ modvar
18
19 contains
20
21   subroutine foo (i)
22     integer :: i
23     write (*, 100) i
24  100 format (1h , "i=", i6)                     ! { dg-warning "The H format specifier at ... is a Fortran 95 deleted feature" }
25   end subroutine foo
26
27 end module global
28
29  use global
30  integer :: a,b, c(20)
31  integer(8) :: ierr
32  character*80 :: buffer(3)
33
34 ! Appending to a USE associated namelist is an extension.
35
36  NAMELIST /NL/ a,b                              ! { dg-warning "already is USE associated" }
37
38  a=1 ; b=2
39
40 !9.2.2.1:
41  write(c, *) a, b                               !  { dg-error "array" }
42 !Was correctly picked up before patch.
43  write(buffer((/3,1,2/)), *) a, b               !  { dg-error "vector subscript" }
44
45 !9.2.2.2 and one of 9.4.1
46 !________________________
47
48  write(6, NML=NL, FMT = '(i6)')                 !  { dg-error "group name and format" }
49  write(6, NML=NL, FMT = 200)                    !  { dg-error "group name and format" }
50
51 !9.4.1
52 !_____
53 !
54
55 ! R912
56 !Was correctly picked up before patch.
57  write(6, NML=NL, iostat = ierr)                ! { dg-warning "requires default INTEGER" }
58
59 ! Constraints
60 !Was correctly picked up before patch.
61  write(1, fmt='(i6)', end = 100) a              ! { dg-error "END tag" }
62 !Was correctly picked up before patch.
63  write(1, fmt='(i6)', eor = 100) a              ! { dg-error "EOR tag" }
64 !Was correctly picked up before patch.
65  write(1, fmt='(i6)', size = b) a               ! { dg-error "SIZE=specifier not allowed" }
66
67
68  READ(1, fmt='(i6)', end = 900) a               ! { dg-error "not defined" }
69  READ(1, fmt='(i6)', eor = 900, advance='NO') a ! { dg-error "not defined" }
70  READ(1, fmt='(i6)', ERR = 900) a               ! { dg-error "not defined" }
71
72 !Was correctly picked up before patch.
73  READ(1, fmt=800) a                             ! { dg-error "not defined" }
74
75
76 100 continue
77 200 format (2i6)
78  END
79
80 ! { dg-final { cleanup-modules "fails global" } }