File: blockerrors.fcl

package info (click to toggle)
ftnchek 3.1.2-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,436 kB
  • ctags: 5,393
  • sloc: ansic: 24,609; fortran: 5,565; yacc: 3,682; sh: 2,518; makefile: 772; lisp: 264; f90: 94; perl: 76
file content (170 lines) | stat: -rw-r--r-- 6,430 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170

FTNCHEK Version 3.1 May 2001

File blockerrors.f:

      1       program blocks
      2 ! program with various errors in balancing block structures
      3         real x
      4         integer n
      5         x = bar(1.0)
      6         if( x .gt. 0 ) then
                ^
Warning near line 6 col 9: Construct name missing from IF statement
      7            call baz(x)
      8            n = int(x)
      9            select case (n)
                   ^
Warning near line 9 col 12: Construct name missing from SELECT statement
     10               case(1)
     11                  call baz(2.0)
     12               case(2:10)
     13                  call baz(3.0)
     14               case(-1,11:100,300)
     15                  call baz(4.0)
     16               case default
     17                  call baz(5.0)
     18            end select
     19         else
     20            k = 0
     21            loop1: do i=1,100
     22               loop2:    do j=1,10
     23                  write(*,*) i,j,i*j
     24                  if( i .eq. 50 ) exit loopdedo   ! wrong construct name
                                         ^
Error near line 24 col 34: construct name LOOPDEDO does not match name of any
 enclosing DO construct
     25                  k = k + j
     26                  if( k .eq. 50) cycle loop2
     27               end do loop2
     28               write(*,*) k*i**2
     29            enddo foop1
                   ^
Error near line 29 col 12: Name FOOP1 does not match construct name LOOP1
     30            case2: select case (n)
     31               case(1) case2
     32                  call baz(2.0)
     33               case(2:10) caseZ
                      ^
Error near line 33 col 15: Name CASEZ does not match construct name CASE2
     34                  call baz(3.0)
     35               case(-1,11:100,300) case2
                      ^
Error near line 35 col 15: Name CASE2 does not match construct name CASEZ
     36                  call baz(4.0)
     37               case default case2
     38 !  do-loops with shared terminator
     39                  do 100 i=1,10
                         ^
Warning near line 39 col 18: Construct name missing from DO statement
     40                     do 100 j=1,10
                            ^
Warning near line 40 col 21: Construct name missing from DO statement
     41                        print *, i, j, i*j
     42  100             continue
                         ^
Warning near line 42 col 18: DO loop not terminated by ENDDO
                         ^
Warning near line 42 col 18: Obsolescent feature: shared DO terminator
         ^
Warning near line 42 col 2: obsolescent feature: labeled statement
     43                  do 200 i=1,10
                         ^
Warning near line 43 col 18: Construct name missing from DO statement
     44                     do 250 j=1,10
                            ^
Warning near line 44 col 21: Construct name missing from DO statement
     45                        print *, i, j, i*j
     46  200                continue                  ! terminators out of order
                            ^
Warning near line 46 col 21: DO loop not terminated by ENDDO
                            ^
Error near line 46 col 21: Label 200 on DO loop terminator does not match 
 corresponding DO label 250 above
         ^
Warning near line 46 col 2: obsolescent feature: labeled statement
     47  250             end do
                         ^
Error near line 47 col 18: Label 250 on DO loop terminator does not match 
 corresponding DO label 200 above
         ^
Warning near line 47 col 2: obsolescent feature: labeled statement
     48            end select case2
     49         end if
     50         if( x .eq. 0) exit                    ! no enclosing DO
                              ^
Error near line 50 col 23: statement not within range of any DO loop
     51         else if( x .lt. 0 ) then              ! else has no matching then
                ^
Error near line 51 col 9: ELSE statement does not match PROGRAM block it
 closes
     52            print *, 'Hello'
     53         end select                            ! should be end if
                ^
Error near line 53 col 9: ENDSELECT statement does not match IF block it
 closes
     54       end program blocks
              ^
Error near line 54 col 7: no construct to end here


     55       function bar(c)
     56         real a, b, c ,d
     57         read *, a
     58 ! This block is from section 8.1.2.3 of the F90 standard, except for
     59 ! removing space between some keywords
     60         if ( a .gt. 0 ) then
                ^
Warning near line 60 col 9: Construct name missing from IF statement
     61            b = c/a
     62            if (b .gt. 0) then
                   ^
Warning near line 62 col 12: Construct name missing from IF statement
     63               d = 1.0
     64            endif
     65         elseif (c .gt. 0) then
     66            b = a/c
     67            d = -1.0
     68         else
     69            b = abs (max (a, c))
     70            d = 0
     71         endif
     72         bar = d*b
     73       end subroutine
              ^
Error near line 73 col 7: ENDSUBROUTINE statement does not match FUNCTION 
 block it closes


     74       subroutine baz(c)
     75         real a, b, c ,d
     76         read *, a
     77 ! Same as above but with spaces restored and construct names added
     78         first_if: if ( a .gt. 0 ) then
     79            b = c/a
     80            second_if: if (b .gt. 0) then
     81               d = 1.0
     82            end if second_if
     83         else if (c .gt. 0) then firstif
                ^
Error near line 83 col 9: Name FIRSTIF does not match construct name FIRST_IF
     84            b = a/c
     85            d = -1.0
     86         else first_if
                ^
Error near line 86 col 9: Name FIRST_IF does not match construct name FIRSTIF
     87            b = abs (max (a, c))
     88            d = 0
     89         end if
                ^
Error near line 89 col 9: Construct name FIRST_IF missing
     90         print *, a, b, c, d
     91       end subroutine bazz
              ^
Error near line 91 col 7: Name BAZZ does not match subprogram name BAZ



 15 syntax errors detected in file blockerrors.f
 14 warnings issued in file blockerrors.f