



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




CMSC 631 – Program Analysis and Understanding Fall 2004
CMSC 631, Fall 2004 2
■ (^) Static analysis
CMSC 631, Fall 2004 3
■ (^) Office: 4129 AVW ■ (^) E-mail: jfoster at cs.umd.edu ■ (^) Office hours: Tuesday, Friday 11am-12pm
■ E-mail: kleene at cs.umd.edu
CMSC 631, Fall 2004 4
■ (^) Ideas we will use in this class:
■ Pierce, Types and Programming Languages ■ Huth and Ryan, Logic in Computer Science
■ (^) Typically, papers available on the web
■ (^) http://corundum.cs.umd.edu:8000/CMSC ■ (^) Post a few sentences to a paragraph or two on
CMSC 631, Fall 2004 7
■ First post! can just put up a summary ■ (^) Later posts need to take earlier posts into account ■ (^) Posting earlier is less work
■ (^) Includes talk on selected paper in 2nd half of course
CMSC 631, Fall 2004 8
■ Programming assignments (20% of grade)
■ (^) Much more effective than listening to a lecture
CMSC 631, Fall 2004 9
■ (^) So you have to do research as part of the class
■ (^) Any topic vaguely related to the class is acceptable
■ Will ease up on homeworks, reading
CMSC 631, Fall 2004 10
■ (^) Project proposal (one page) + talk with me ■ (^) Project write-up
■ (^) And a couple more could have been
■ (^) Based on written and programming assignments ■ (^) Take-home or in-class (we’ll vote at the end of the semester)
CMSC 631, Fall 2004 19
■ (^) Out(S) = Gen(S) U (In(S) - Kill(S)) ■
■ Finite height lattice ■ (^) Monotone transformation functions
x =? x = 3 x = 6 ...
x = *
CMSC 631, Fall 2004 20
x := 0
v := 3 v := 4 + x
x := x + v
x 1 := 0
v 1 := 3 v 2 := 4 + x 1
v 3 := !(v 1 ,v 2 )
x 2 := x 1 + v 3
CMSC 631, Fall 2004 21
variable function function application
■ (replace by in )
CMSC 631, Fall 2004 22
■ (^) true = false = ■ (^) if a then b else c =
■ (^) But after a while, realized could be general-purpose
■ Similar to lambda-calculus
■ (^) Is 00110110111100101100111010101000
■ To choose operation (which + op), e.g., FORTRAN ■ To avoid programming mistakes
CMSC 631, Fall 2004 25
in type environment , expression has type
dom(A) !
!
!
!
!! !
!
CMSC 631, Fall 2004 26
■ If for each object^ of type^ there is an object^ of type such that for all programs defined in terms of , the behavior of is unchanged when is substituted for then is a subtype of.
■ (^) If anyone expecting a can be given an instead, then is a subtype of.
CMSC 631, Fall 2004 27
■ (^) Hoare, Dijkstra, Gries, others
CMSC 631, Fall 2004 28
■ If statement is executed in a state satisfying precondition , then will terminate, and will hold of the resulting state ■ (^) Partial correctness: ignore termination
■ (^) Axiom: ■ (^) Example:
■ (^) Lots of parallelism (concurrency), but ■ (^) Not a lot of structure (e.g., no dynamic allocation)
loop out: x1 := 1; last := 1 req: await x2 = 0 or last = 2 in: x1 := 0 end loop
loop out: x2 := 1; last := 2 req: await x1 = 0 or last = 1 in: x2 := 0 end loop (Example from Henzinger)
||
■ (^) State = (pc1, pc2, x1, x2, last) ■ (^) Is any bad state (iiXXX) reachable from the start state?
oo 001
ro 101 or 012
io 101 rr 112
ir 112
CMSC 631, Fall 2004 37
■ Can perform deep reasoning about programs ■ (^) Array out-of-bounds ■ (^) Null pointer errors ■ (^) Failure to satisfy internal invariants
CMSC 631, Fall 2004 38
■ Format-string vulnerabilities, deadlocks, file I/O protocol errors, kernel security holes
■ (^) Memory allocation and deallocation errors, library protocol errors, misuse of locks
CMSC 631, Fall 2004 39
■ (^) Very deep theory ■ (^) But lots of practical applications
■ Focus on program correctness instead of speed ■ Forget about full correctness, though ■ Scalability to large programs essential