CS6843 Program Analysis

Mode: Contact course
Course description
Course faculty: Rupesh Nasre (rupesh0508@gmail.com).

Assign 1: May 25
Assign 2: June 8
EndSem: June 24 23 at 14:30 in CSB 11

Slides and Reading Material

Two assignments (66%), exam (34%)

Assign 1: Implement a static analysis to find out if two functions commute. Two functions f1 and f2 commute if for some program state S, the effect of executing f1 followed by f2 is the same as that of executing f2 followed by f1 in the same state S. For instance, the following two functions commute for global variable x (ignoring end-conditions):

f1() {
  x = x + 1;
f2() {
  x = x - 1;
You have to create 10 simple test-cases. I will ask you for a demo. The program contains only global integers and two functions, arithmetic expressions with +-*/ and assignments. No if-else, no loops, no function calls, no arrays, no main, etc. Note that the expressions can be arbitrary, for instance, x * y - 3 / z + 5 and there could be multiple assignment statements in each function.

Assign 2: Implement a static analysis to check if every opened file is closed before main() completes. The program contains only main, FILE pointers, fopen, fclose, fscanf, fprints functions, if-else, loops, no user-defined functions, no arrays, etc. An fclose must be present across all paths from fopen / fscanf / fprintf to end of main.

If you want to use C, you can use LLVM.
If you want to use Java, here is a link to the tools

Submit the code by email as a single tar-gzipped file containing only the code/files you wrote, by 23:59 of the deadline.

The final grading is as follows.
S: >= 95 + overall performance
A: >= 80
B: >= 70
C: >= 60
D: >= 50
E: >= 40