Skip to content

WI #2039 Compute cyclic call using transitive closure. #2052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions TypeCobol.Analysis.Test/BasicCfgInstrs/CyclicPerformRecursive.cbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
 IDENTIFICATION DIVISION.
PROGRAM-ID. TCOMFL06.
PROCEDURE DIVISION.
main.
perform a
goback
.
a.
perform b
.
b.
perform c
.
c.
perform a
.
END PROGRAM TCOMFL06.
11 changes: 11 additions & 0 deletions TypeCobol.Analysis.Test/BasicCfgInstrs/CyclicPerformRecursive.diag
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Diagnostics ---
Line 5[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM a', recursive instruction is ' perform b' at line 9.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't possible to report the full perform chain ?
Like perform a, Line 5 > perform b, Line 9 > perform c, Line 12 > perform a, Line 15?

With the current diagnostics, the Cobol developer have to manualy group error message together to understand what the cycle is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact this the current way of reporting, but the Perform Call Chain contains all information to do that.

Line 5[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM a', recursive instruction is ' perform c' at line 12.
Line 5[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM a', recursive instruction is ' perform a' at line 15.
Line 6[12,17] <37, Warning, General> - Warning: Unreachable code detected
Line 9[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM b', recursive instruction is ' perform c' at line 12.
Line 9[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM b', recursive instruction is ' perform a' at line 15.
Line 9[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM b', recursive instruction is ' perform b' at line 9.
Line 12[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM c', recursive instruction is ' perform a' at line 15.
Line 12[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM c', recursive instruction is ' perform b' at line 9.
Line 12[12,20] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM c', recursive instruction is ' perform c' at line 12.
51 changes: 51 additions & 0 deletions TypeCobol.Analysis.Test/BasicCfgInstrs/CyclicPerformRecursive.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
digraph Cfg {
compound=true;
node [
shape = "record"
]

edge [
arrowtail = "empty"
]
Block0 [
label = "{START|}"
]
Block1 [
label = "{MAIN. Block1|}"
]
Block2 [
label = "{Block2| perform a\l}"
]
Block14 [
label = "{A. Block14|}"
]
Block15 [
label = "{Block15| perform b\l}"
]
Block25 [
label = "{B. Block25|}"
]
Block18 [
label = "{Block18| perform c\l}"
]
Block27 [
label = "{C. Block27|}"
]
Block21 [
label = "{Block21| perform a\l}"
]
Block29 [
label = "{A. Block29|}"
]
Block0 -> Block1
Block1 -> Block2
Block2 -> Block14
Block14 -> Block15
Block15 -> Block25
Block25 -> Block18
Block18 -> Block27
Block27 -> Block21
Block21 -> Block29
Block29 -> Block15

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
--- Diagnostics ---
Line 28[15,29] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2'.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 16.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec3' at line 20.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec' at line 28.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 39.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec' at line 28.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 16.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec3' at line 20.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 39.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 39.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec' at line 28.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 16.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec3' at line 20.
Line 29[15,57] <37, Warning, General> - Warning: Unreachable code detected
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
--- Diagnostics ---
Line 31[15,29] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2'.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 17.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec3' at line 21.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec4' at line 23.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec' at line 31.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 42.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec3 test after varying n from 1 by 1 until n' at line 53.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec4 varying n from 1 by 1 until n > 5' at line 57.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec3 test after varying n from 1 by 1 until n' at line 53.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec4 varying n from 1 by 1 until n > 5' at line 57.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec2' at line 42.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec' at line 31.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec2' at line 17.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec3' at line 21.
Line 9[12,27] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec4' at line 23.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec' at line 31.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 17.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec3' at line 21.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec4' at line 23.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 42.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec3 test after varying n from 1 by 1 until n' at line 53.
Line 17[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec4 varying n from 1 by 1 until n > 5' at line 57.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 42.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec' at line 31.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 17.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec3' at line 21.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec4' at line 23.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec3 test after varying n from 1 by 1 until n' at line 53.
Line 21[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec4 varying n from 1 by 1 until n > 5' at line 57.
Line 32[15,57] <37, Warning, General> - Warning: Unreachable code detected
Line 57[15,64] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec4 varying n from 1 by 1 until n > 5'.
Line 57[15,64] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec4', recursive instruction is ' perform pararec3 test after varying n from 1 by 1 until n'.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--- Diagnostics ---
Line 6[12,23] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM main', recursive instruction is ' PERFORM main'.
Line 6[12,23] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM main', recursive instruction is ' PERFORM main' at line 6.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--- Diagnostics ---
Line 16[15,29] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec'.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec' at line 16.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--- Diagnostics ---
Line 27[15,29] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2'.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 16.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec' at line 27.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec' at line 27.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 16.
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
--- Diagnostics ---
Line 28[15,29] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2'.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 16.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec3' at line 20.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec' at line 28.
Line 8[12,26] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec', recursive instruction is ' perform pararec2' at line 39.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec' at line 28.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 16.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec3' at line 20.
Line 16[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec2', recursive instruction is ' perform pararec2' at line 39.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 39.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec' at line 28.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec2' at line 16.
Line 20[15,30] <37, Warning, General> - Warning: A recursive loop has been encountered while analyzing 'PERFORM pararec3', recursive instruction is ' perform pararec3' at line 20.
Loading