



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 Spring 2006
CMSC 631, Fall 2004 (^2)
■ Static analysis
CMSC 631, Fall 2004 (^3)
■ (^) Office: 4129 AVW ■ (^) E-mail: jfoster at cs.umd.edu ■ Office hours: M 1-2pm, Tu 11am-12pm
CMSC 631, Fall 2004 (^4)
■ (^) Ideas we will use in this class:
CMSC 631, Fall 2004 (^5)
■ Pierce, Types and Programming Languages ■ (^) Huth and Ryan, Logic in Computer Science
CMSC 631, Fall 2004
■ (^) https://forum.cs.umd.edu/forumdisplay.php?f=
6
CMSC 631, Fall 2004 (^7)
■ (^) Programming assignments (20% of grade)
■ (^) Much more effective than listening to a lecture CMSC 631, Fall 2004 (^8)
■ (^) No late submissions
■ E.g., religious holidays ■ Inform me as soon as possible
CMSC 631, Fall 2004 (^9)
■ (^) More later on in the semester ■ (^) Should come prepared to contribute to discussion
■ Read 1-2 papers on a topic ■ Present a lecture in class about the material
CMSC 631, Fall 2004 (^10)
■ (^) 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
■ Project proposal (one page) + talk with me ■ Project write-up
■ (^) 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)
x := 3
y := z + w y := 0
x := 2 * x
x = *
x = 3
x = 3
x = 3
x = 3
x = 6
x =?
x =?
x =?
CMSC 631, Fall 2004 (^20)
■ (^) 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 (^21)
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 (^22)
variable function function application
■ (^) (replace by in )
■ (^) true = false = ■ if a then b else c =
■ (^) But after a while, realized could be general-purpose
■ Similar to lambda-calculus
CMSC 631, Fall 2004 (^25)
■ (^) Is 00110110111100101100111010101000
■ To choose operation (which + op), e.g., FORTRAN ■ To avoid programming mistakes
CMSC 631, Fall 2004 (^26)
in type environment , expression has type
dom(A) !
!
!
!
!! !
!
CMSC 631, Fall 2004 (^27)
■ 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 (^28)
■ Hoare, Dijkstra, Gries, others
■ (^) 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)
||
CMSC 631, Fall 2004 (^37)
■ (^) Focus on device drivers: lock/unlock protocol errors, and other errors sequencing of operations
CMSC 631, Fall 2004 (^38)
■ (^) Can perform deep reasoning about programs ■ (^) Array out-of-bounds ■ (^) Null pointer errors ■ Failure to satisfy internal invariants
■ (^) Format-string vulnerabilities, deadlocks, file I/O protocol errors, kernel security holes
■ Memory allocation and deallocation errors, library protocol errors, misuse of locks
■ (^) 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