amit-davidson / Chronos

Chronos - A static race detector for the go language
MIT License
424 stars 11 forks source link

Improve control flow graph to support for loops #2

Closed amit-davidson closed 3 years ago

amit-davidson commented 3 years ago

Proposal

The control flow graph traverses between vertices from the start to the last block using DFS. If it reaches a block where not all of his dependencies are calculated (A block after a condition where not all the preceding branches were visited yet), then it returns up the graph, and the block will be reached again later from a different path. Loops pose a problem since the graph is cyclic (due to the back edge between the loop body and header). As a result, the dependencies can't be calculated since each vertice depends on the other. The traversing function should be improved to support such cases.

For more details: https://en.wikipedia.org/wiki/Control-flow_graph

amit-davidson commented 3 years ago

Fixed by: https://github.com/amit-davidson/Chronos/pull/19