PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / io_constraints_1.f90
blobc6f956958c7eb0088be75bfe32bf4469765bbaca
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.
6 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
8 module fails
10 2000 format (1h , 2i6) ! { dg-error "Format statement in module" }
12 end module fails
14 module global
16 integer :: modvar
17 namelist /NL/ modvar
19 contains
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
27 end module global
29 use global
30 integer :: a,b, c(20)
31 integer(8) :: ierr
32 character(80) :: buffer(3)
34 ! Appending to a USE associated namelist is an extension.
36 NAMELIST /NL/ a,b ! { dg-error "already is USE associated" }
38 a=1 ; b=2
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" }
45 !9.2.2.2 and one of 9.4.1
46 !________________________
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" }
51 !9.4.1
52 !_____
55 ! R912
56 !Was correctly picked up before patch.
57 write(6, NML=NL, iostat = ierr) ! { dg-error "requires default INTEGER" }
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" }
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" }
72 !Was correctly picked up before patch.
73 READ(1, fmt=800) a ! { dg-error "not defined" }
76 100 continue
77 200 format (2i6)
78 END