Skip to content

Confusion about A3 testcase Loops.javaΒ #31

@NyxWh1sper

Description

@NyxWh1sper

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) {
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions