Homework 6: File Property Simulation

Problem

We wish to design an analysis that can check that close is only called if the file is currently open, that open is only called if the file is currently closed, and that the file is definitely closed at the program exit.

In this homework, you are expected to implement a pass to perform an intraprocedural path-sensitive property checking(i.e. file state) for a C program.

We assume that

You can generate the bc code by the following command or use the bc code provided in the benchmark section.

Sample Output

The output of the example.cc is as follows. You should output the file name, final state, and its paths at exit point of program.

Benchmark

Skeleton