Skip to content

Conversation

@fm-117
Copy link
Contributor

@fm-117 fm-117 commented Jul 2, 2020

This PR focuses on actual integration of CFG/DFA as a new kind of analyzer instead of using NodeDispatcher listeners (which are now totally removed).

Diagnostics need to be improved

@fm-117 fm-117 added this to the v1.5 Data flow / Control flow milestone Jul 2, 2020
@fm-117 fm-117 requested review from mayanje, rooksdo and smedilol July 2, 2020 15:13
@fm-117 fm-117 self-assigned this Jul 2, 2020
@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Jul 2, 2020
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Jul 3, 2020
@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Jul 3, 2020
@fm-117 fm-117 requested a review from mayanje July 7, 2020 14:46
label = "{Block2| goback\l}"
]
Block0 -> Block1
Block1 -> Block2
Copy link
Contributor

Choose a reason for hiding this comment

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

The code contains an error:
Line 4[12,12] <30, Error, Semantics> - Semantic error: Statement ' go to b' located at line 10, column 12 prevents this PERFORM statement to reach its exit.

IBM Compiler only reports a warning, because the code can still be executed.
Execution will produce an abend U4038, because there is no goback at the end of paragraph b. But if there is a goback, the execution is ok.
So shall we create an error or a warning? I think it should be a warning to behave like IBM compiler.
We can then ask our users if they want an error. In this case the error could be set as parameter of CLI/LSP (like parameter diagnostic.checkEndAlignment)

For the CFG : the goback statement can never be reached, but the dot file shows otherwise.
Line Block1 -> Block2 should not appear in the dot file.

Copy link
Contributor Author

@fm-117 fm-117 Jul 10, 2020

Choose a reason for hiding this comment

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

Ok to turn this diagnostic into a Warning. Edit: done 916f17c.

About the Block1 to Block2 edge, this edge is created while building the graph. It is only after resolving all GOTO/ALTER/PERFORM that we could find out which part of the code is unreachable or not.
The graph is built as to contain all and every possible paths but we need a post-build analysis to actually find which parts are unreachable. Do you confirm @mayanje ?

Copy link
Contributor

@mayanje mayanje Jul 24, 2020

Choose a reason for hiding this comment

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

In my opinion this case the error is that the perform goes out of paragraph a and thus the goback will never be executed, but this a consequence of the abend U4038 and not the control flow. So you are right to stay iso with IBM Compiler, it is a warning (a Severe Warning).
The unreachability of the goback instruction can be detected by an abstract interpretation in this case, because we must detect that finally we will face an abend U4038.

@trafico-bot trafico-bot bot added ⚠️ Changes requested Pull Request needs changes before it can be reviewed again and removed 🔍 Ready for Review Pull Request is not reviewed yet labels Jul 8, 2020
Block8 -> Block9
Block9 -> Block10

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it normal that there's no Block11 declared?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get the meaning of your question 😕
During parsing, the CFG builder will create new block each time a new sentence is encountered and also when branching is required. After building, blocks may be cloned if they participate in a PERFORM target group. When generating the dot file however, only blocks connected to the root are considered. Some blocks created during parsing may finally not appear in the graph.
Do you think the resulting graph is wrong/missing some elements ?

Copy link
Contributor

@rooksdo rooksdo Jul 28, 2020

Choose a reason for hiding this comment

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

I was checking the tests from the .dot files directly, I was wondering about the numbering as I couldn't see any block11 when block10 and block12 were declared. It's just that it's the only block number that doesn't appear in the .dot file although other empty blocks are still declared (block2, block4...). You probably gave me the answer just above so I'll look again at the graphs. Thanks.

@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed ⚠️ Changes requested Pull Request needs changes before it can be reviewed again labels Jul 10, 2020
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Jul 15, 2020
@fm-117 fm-117 requested review from rooksdo and smedilol July 22, 2020 06:41
@trafico-bot trafico-bot bot added the ⚠️ Changes requested Pull Request needs changes before it can be reviewed again label Aug 3, 2020
@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed ⚠️ Changes requested Pull Request needs changes before it can be reviewed again labels Aug 4, 2020
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Aug 5, 2020
@fm-117 fm-117 requested a review from smedilol August 5, 2020 07:13
Block28 -> Block29
Block29 -> Block30
Block30 -> Block31

Copy link
Contributor

@rooksdo rooksdo Aug 10, 2020

Choose a reason for hiding this comment

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

As discussed together from analysis on perform loops.
Graph doesn't show loop on block30 for Perform until (as for Perform varying in PerfromNested0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This bug shall be adressed in the main PR. I'll copy your comment there.

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Aug 14, 2020
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Aug 21, 2020
@fm-117 fm-117 merged commit 1b15533 into 1260_CFG_SemanticDomainLite Aug 21, 2020
@trafico-bot trafico-bot bot added the ✨ Merged Pull Request has been merged successfully label Aug 21, 2020
@fm-117 fm-117 deleted the 1260_CFG_SemanticDomainLite_IntegrateAsAnalyzer branch August 21, 2020 09:07
@mayanje mayanje mentioned this pull request Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Merged Pull Request has been merged successfully

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants