Debian Codegraph @

gcc/testsuite/gfortran.dg/do_check_13.f90

raw
1 program main
2 implicit none
3 integer :: i1, i2, i3, i4, i5, i6, i7
4 integer :: j
5 do i1=1,10
6 call sub1 ! { dg-error "Index variable 'i1' redefined" }
7 end do
8 do i2=1,10
9 call sub2 ! { dg-error "Index variable 'i2' redefined" }
10 end do
11 do i3=1,10
12 j = fcn3() ! { dg-error "Index variable 'i3' redefined" }
13 end do
14 do i4=1,10
15 j = fcn4() ! { dg-error "Index variable 'i4' redefined" }
16 end do
17 do i5=1,10
18 call sub5 ! { dg-error "Index variable 'i5' set to undefined" }
19 end do
20
21 call sub6
22
23 do i7=1,10
24 call sub7 ! { dg-error "Index variable 'i7' not definable" }
25 end do
26 contains
27 subroutine sub1
28 i1 = 5 ! { dg-error "Index variable 'i1' redefined" }
29 end subroutine sub1
30
31 subroutine sub2
32 do i2=1,5 ! { dg-error "Index variable 'i2' redefined" }
33 end do
34 end subroutine sub2
35
36 integer function fcn3()
37 i3 = 1 ! { dg-error "Index variable 'i3' redefined" }
38 fcn3 = i3
39 end function fcn3
40
41 integer function fcn4()
42 open (10,file="foo.dat", iostat=i4) ! { dg-error "Index variable 'i4' redefined" }
43 fcn4 = 12
44 end function fcn4
45
46 subroutine sub5
47 integer :: k
48 k = intentout(i5) ! { dg-error "Index variable 'i5' set to undefined" }
49 end subroutine sub5
50
51 subroutine sub6
52 do i6=1,10
53 call sub6a ! { dg-error "Index variable 'i6' redefined" }
54 end do
55 end subroutine sub6
56
57 subroutine sub6a
58 i6 = 5 ! { dg-error "Index variable 'i6' redefined" }
59 end subroutine sub6a
60
61 subroutine sub7
62 integer :: k
63 k = intentinout (i7) ! { dg-error "Index variable 'i7' not definable" }
64 end subroutine sub7
65
66 integer function intentout(i)
67 integer, intent(out) :: i
68 end function intentout
69
70 integer function intentinout(i)
71 integer, intent(inout) :: i
72 end function intentinout
73 end program main
74
75 module foo
76 integer :: j1
77 contains
78 subroutine mod_sub_1
79 do j1=1,10
80 call aux ! { dg-error "Index variable 'j1' redefined" }
81 end do
82 end subroutine mod_sub_1
83 subroutine aux
84 j1 = 3 ! { dg-error "Index variable 'j1' redefined" }
85 end subroutine aux
86 end module foo