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

Confusion about A3 testcase Loops.java #31

Open
NyxWh1sper opened this issue Mar 6, 2025 · 0 comments
Open

Confusion about A3 testcase Loops.java #31

NyxWh1sper opened this issue Mar 6, 2025 · 0 comments

Comments

@NyxWh1sper
Copy link

The check mechanism in testcase method deadLoop() inside "Loops.java" is inproper. I must add cfg.exitNode(), which is nop, to the visited nodes at first to get passed. However, according to my observation, the predecessor of the nop is return which indicates the nop is actually dead code.

Additionally, I also wonder should I assume the cfg.exitNode() can eventually be visited. Without this assumption, I can still discover all reachable nodes by performing BFS from the entry node. Am I overlooking some corner cases?

Here is the source code of testcase "Loops.java":

class Loops {

    void deadLoop() {
        int x = 1;
        int y = 0;
        int z = 100;
        while (x > y) {
            use(z);
        }
        dead(); // unreachable branch
    }

    void dead() {
    }

    void use(int n) {
    }
}
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

No branches or pull requests

1 participant