Skip to content
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

Disconnected control-flow graph when building a CFG for a method with a switch case statement #3787

Closed
udit-dasari opened this issue Feb 9, 2021 · 1 comment · Fixed by #4004

Comments

@udit-dasari
Copy link

Hi, i'm using spoon-control-flow graph to build a cfg for a method which contains a switch case statement and the control flow graph i'm getting is disconnected (There is an edge missing).

Here is the function i'm building CFG for:

public void fun()
    {
        int a = 10;
        int b=0;
        switch(a)
        {
            case 1:
            b=10;
            case 2:
            b=20;
        }
        System.out.println("Not Connected");
    }

Code for building the CFG:

val builder = ControlFlowBuilder()
val cfg = builder.build(ctMethod) // ctMethod corresponds to the above method
cfg.simplify()
cfg.toGraphVisText()

The generate graph:
test

There is an edge missing between statement: 70 and statement: 72

@andrewbwogi
Copy link
Contributor

I'll see if I can reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants