Skip to content

Commit 88561a7

Browse files
committed
WI #1267 Fix recursion detection
Ported from original commit dae672f
1 parent d1bf585 commit 88561a7

16 files changed

+438
-289
lines changed

TypeCobol.Analysis.Test/BasicCfgInstrs/CGM110.diag

Lines changed: 0 additions & 204 deletions
Large diffs are not rendered by default.

TypeCobol.Analysis.Test/BasicCfgInstrs/IX105A.diag

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,7 @@
22
Line 1[8,19] <37, Warning, General> - Warning: "END PROGRAM" is missing.
33
Line 339[12,15] <37, Warning, General> - Warning: GOBACK should be used instead of STOP RUN OffendingSymbol=[12,15:STOP]<STOP>
44
Line 346[12,38] <37, Warning, General> - Warning: "end-if" is missing
5-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN 2 TIMES'.
6-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN 2 TIMES'.
7-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN 3 TIMES'.
8-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN 3 TIMES'.
9-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN'.
10-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN'.
11-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN'.
12-
Line 350[40,40] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM WRITE-LINE', recursive instruction is ' PERFORM WRT-LN'.
135
Line 350[12,37] <37, Warning, General> - Warning: "end-if" is missing
14-
Line 351[15,15] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM FAIL-ROUTINE THRU FAIL-ROUTINE-EX', recursive instruction is ' PERFORM WRITE-LINE 2 TIMES'.
15-
Line 351[15,15] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM FAIL-ROUTINE THRU FAIL-ROUTINE-EX', recursive instruction is ' PERFORM WRITE-LINE'.
16-
Line 351[15,15] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM FAIL-ROUTINE THRU FAIL-ROUTINE-EX', recursive instruction is ' PERFORM WRITE-LINE 2 TIMES'.
17-
Line 352[22,22] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM BAIL-OUT THRU BAIL-OUT-EX', recursive instruction is ' PERFORM WRITE-LINE 2 TIMES'.
186
Line 355[12,38] <37, Warning, General> - Warning: "end-if" is missing
197
Line 381[12,50] <37, Warning, General> - Warning: "end-if" is missing
208
Line 388[12,45] <37, Warning, General> - Warning: "end-if" is missing
@@ -31,10 +19,6 @@ Line 458[12,12] <37, Warning, General> - Warning: Statement ' GO TO WRITE-
3119
Line 459[12,12] <37, Warning, General> - Warning: Statement ' GO TO WRITE-TEST-GF-01-FAIL' located at line 485, column 15 prevents this PERFORM statement to reach its exit.
3220
Line 460[12,12] <37, Warning, General> - Warning: Statement ' GO TO WRITE-TEST-GF-01-FAIL' located at line 478, column 15 prevents this PERFORM statement to reach its exit.
3321
Line 461[12,37] <37, Warning, General> - Warning: "end-if" is missing
34-
Line 493[12,12] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM PRINT-DETAIL', recursive instruction is ' PERFORM WRITE-LINE'.
35-
Line 493[12,12] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM PRINT-DETAIL', recursive instruction is ' PERFORM WRITE-LINE'.
36-
Line 493[12,12] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM PRINT-DETAIL', recursive instruction is ' PERFORM FAIL-ROUTINE THRU FAIL-ROUTINE-EX'.
37-
Line 493[12,12] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM PRINT-DETAIL', recursive instruction is ' PERFORM BAIL-OUT THRU BAIL-OUT-EX'.
3822
Line 507[12,40] <37, Warning, General> - Warning: "end-if" is missing
3923
Line 511[12,33] <37, Warning, General> - Warning: "end-if" is missing
4024
Line 546[12,42] <37, Warning, General> - Warning: "end-if" is missing
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
IDENTIFICATION DIVISION.
2+
PROGRAM-ID. DVZZMFT1.
3+
DATA DIVISION.
4+
PROCEDURE DIVISION.
5+
main.
6+
PERFORM a
7+
GOBACK
8+
.
9+
a.
10+
PERFORM b
11+
PERFORM c
12+
.
13+
b.
14+
PERFORM d
15+
.
16+
c.
17+
PERFORM d
18+
.
19+
d.
20+
DISPLAY "end"
21+
.
22+
END PROGRAM DVZZMFT1.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
digraph Cfg {
2+
compound=true;
3+
node [
4+
shape = "record"
5+
]
6+
7+
edge [
8+
arrowtail = "empty"
9+
]
10+
Block0 [
11+
label = "{START|}"
12+
]
13+
Block1 [
14+
label = "{MAIN. Block1|}"
15+
]
16+
Block2 [
17+
label = "{Block2| PERFORM a\l}"
18+
]
19+
subgraph cluster_1{
20+
color = blue;
21+
label = "a";
22+
Block17 [
23+
label = "{A. Block17|}"
24+
]
25+
Block18 [
26+
label = "{Block18| PERFORM b\l}"
27+
]
28+
subgraph cluster_2{
29+
color = blue;
30+
label = "b";
31+
Block30 [
32+
label = "{B. Block30|}"
33+
]
34+
Block23 [
35+
label = "{Block23| PERFORM d\l}"
36+
]
37+
subgraph cluster_4{
38+
color = blue;
39+
label = "d";
40+
Block34 [
41+
label = "{D. Block34| DISPLAY \"end\"\l}"
42+
]
43+
44+
}
45+
Block23 -> Block34 [style=dashed]
46+
47+
Block24 [
48+
label = "{Block24|}"
49+
]
50+
Block30 -> Block23
51+
Block23 -> Block24
52+
53+
}
54+
Block18 -> Block30 [style=dashed]
55+
56+
Block19 [
57+
label = "{Block19|}"
58+
]
59+
Block20 [
60+
label = "{Block20| PERFORM c\l}"
61+
]
62+
subgraph cluster_3{
63+
color = blue;
64+
label = "c";
65+
Block32 [
66+
label = "{C. Block32|}"
67+
]
68+
Block26 [
69+
label = "{Block26| PERFORM d\l}"
70+
]
71+
subgraph cluster_5{
72+
color = blue;
73+
label = "d";
74+
Block35 [
75+
label = "{D. Block35| DISPLAY \"end\"\l}"
76+
]
77+
78+
}
79+
Block26 -> Block35 [style=dashed]
80+
81+
Block27 [
82+
label = "{Block27|}"
83+
]
84+
Block32 -> Block26
85+
Block26 -> Block27
86+
87+
}
88+
Block20 -> Block32 [style=dashed]
89+
90+
Block21 [
91+
label = "{Block21|}"
92+
]
93+
Block17 -> Block18
94+
Block18 -> Block19
95+
Block19 -> Block20
96+
Block20 -> Block21
97+
98+
}
99+
Block2 -> Block17 [style=dashed]
100+
101+
Block3 [
102+
label = "{Block3| GOBACK\l}"
103+
]
104+
Block0 -> Block1
105+
Block1 -> Block2
106+
Block2 -> Block3
107+
108+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
IDENTIFICATION DIVISION.
2+
PROGRAM-ID. DVZZMFT1.
3+
DATA DIVISION.
4+
PROCEDURE DIVISION.
5+
main.
6+
PERFORM a
7+
GOBACK
8+
.
9+
a.
10+
PERFORM b
11+
PERFORM e
12+
.
13+
b.
14+
PERFORM c
15+
.
16+
c.
17+
PERFORM d
18+
.
19+
d.
20+
PERFORM g
21+
.
22+
e.
23+
PERFORM f
24+
.
25+
f.
26+
PERFORM g
27+
.
28+
g.
29+
DISPLAY "end"
30+
.
31+
END PROGRAM DVZZMFT1.
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
digraph Cfg {
2+
compound=true;
3+
node [
4+
shape = "record"
5+
]
6+
7+
edge [
8+
arrowtail = "empty"
9+
]
10+
Block0 [
11+
label = "{START|}"
12+
]
13+
Block1 [
14+
label = "{MAIN. Block1|}"
15+
]
16+
Block2 [
17+
label = "{Block2| PERFORM a\l}"
18+
]
19+
subgraph cluster_1{
20+
color = blue;
21+
label = "a";
22+
Block26 [
23+
label = "{A. Block26|}"
24+
]
25+
Block27 [
26+
label = "{Block27| PERFORM b\l}"
27+
]
28+
subgraph cluster_2{
29+
color = blue;
30+
label = "b";
31+
Block48 [
32+
label = "{B. Block48|}"
33+
]
34+
Block32 [
35+
label = "{Block32| PERFORM c\l}"
36+
]
37+
subgraph cluster_4{
38+
color = blue;
39+
label = "c";
40+
Block52 [
41+
label = "{C. Block52|}"
42+
]
43+
Block38 [
44+
label = "{Block38| PERFORM d\l}"
45+
]
46+
subgraph cluster_5{
47+
color = blue;
48+
label = "d";
49+
Block56 [
50+
label = "{D. Block56|}"
51+
]
52+
Block41 [
53+
label = "{Block41| PERFORM g\l}"
54+
]
55+
subgraph cluster_6{
56+
color = blue;
57+
label = "g";
58+
Block58 [
59+
label = "{G. Block58| DISPLAY \"end\"\l}"
60+
]
61+
62+
}
63+
Block41 -> Block58 [style=dashed]
64+
65+
Block42 [
66+
label = "{Block42|}"
67+
]
68+
Block56 -> Block41
69+
Block41 -> Block42
70+
71+
}
72+
Block38 -> Block56 [style=dashed]
73+
74+
Block39 [
75+
label = "{Block39|}"
76+
]
77+
Block52 -> Block38
78+
Block38 -> Block39
79+
80+
}
81+
Block32 -> Block52 [style=dashed]
82+
83+
Block33 [
84+
label = "{Block33|}"
85+
]
86+
Block48 -> Block32
87+
Block32 -> Block33
88+
89+
}
90+
Block27 -> Block48 [style=dashed]
91+
92+
Block28 [
93+
label = "{Block28|}"
94+
]
95+
Block29 [
96+
label = "{Block29| PERFORM e\l}"
97+
]
98+
subgraph cluster_3{
99+
color = blue;
100+
label = "e";
101+
Block50 [
102+
label = "{E. Block50|}"
103+
]
104+
Block35 [
105+
label = "{Block35| PERFORM f\l}"
106+
]
107+
subgraph cluster_7{
108+
color = blue;
109+
label = "f";
110+
Block54 [
111+
label = "{F. Block54|}"
112+
]
113+
Block45 [
114+
label = "{Block45| PERFORM g\l}"
115+
]
116+
subgraph cluster_8{
117+
color = blue;
118+
label = "g";
119+
Block59 [
120+
label = "{G. Block59| DISPLAY \"end\"\l}"
121+
]
122+
123+
}
124+
Block45 -> Block59 [style=dashed]
125+
126+
Block46 [
127+
label = "{Block46|}"
128+
]
129+
Block54 -> Block45
130+
Block45 -> Block46
131+
132+
}
133+
Block35 -> Block54 [style=dashed]
134+
135+
Block36 [
136+
label = "{Block36|}"
137+
]
138+
Block50 -> Block35
139+
Block35 -> Block36
140+
141+
}
142+
Block29 -> Block50 [style=dashed]
143+
144+
Block30 [
145+
label = "{Block30|}"
146+
]
147+
Block26 -> Block27
148+
Block27 -> Block28
149+
Block28 -> Block29
150+
Block29 -> Block30
151+
152+
}
153+
Block2 -> Block26 [style=dashed]
154+
155+
Block3 [
156+
label = "{Block3| GOBACK\l}"
157+
]
158+
Block0 -> Block1
159+
Block1 -> Block2
160+
Block2 -> Block3
161+
162+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
IDENTIFICATION DIVISION.
2+
PROGRAM-ID. DVZZMFT1.
3+
DATA DIVISION.
4+
PROCEDURE DIVISION.
5+
main.
6+
PERFORM main
7+
GOBACK
8+
.
9+
END PROGRAM DVZZMFT1.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--- Diagnostics ---
2+
Line 6[12,12] <30, Error, Semantics> - Semantic error: A recursive loop has been encountered while analyzing 'PERFORM main', recursive instruction is ' PERFORM main'.

0 commit comments

Comments
 (0)