pascal-lab / Tai-e-assignments

Tai-e assignments for static program analysis
https://tai-e.pascal-lab.net/
GNU Lesser General Public License v3.0
1.01k stars 234 forks source link

Question about A3(DeadCodeDetection) #22

Open RacerZ-fighting opened 8 months ago

RacerZ-fighting commented 8 months ago

When doing graph traversal, I first chose a LinkedList to maintain all visited nodes. But I can't figure out why there would be a false negative test case.

        List<Stmt> isVisited = new LinkedList<>();
        ArrayDeque<Stmt> queue = new ArrayDeque<>();    // BFS queue
        queue.add(cfg.getEntry());
Snipaste_2023-11-15_13-14-47

Then, if I change to use a HashSet, all test cases will pass.