Definition-use graph static analysis example
Consider the graph below:
Examining the define-use-kill patterns along the control flow paths in the DUG and considering the variable x as we traverse the left and then the right path, as shown in the graphs below, we have the following life-cycles of x: ~d (correct), dd (suspicious) and du (correct).
Examining the define-use-kill patterns along the control flow paths in the DUG and considering the variable y as we traverse the left and then the right path, as shown in the graph below, we have the following life-cyles of y: ~u (major blunder), ud (acceptable), du (correct), uk (acceptable), dk (probable programming error).
Examining the define-use-kill patterns along the control flow paths in the DUG and considering the variable z as we traverse the left and then the right path, as shown in the graphs below, we have the following life-cycles of y: ~k (programming error), ku (major blunder), uu (correct), ud (acceptable), kk (probably a programming error), kd (acceptable), du (correct).
In performing a static analysis on this data flow model, the following problems have been discovered:
Variable | Operation |
---|---|
x | define-define (dd) |
y | ~-use (~u) |
y | define-kill (dk) |
z | ~-kill (~k) |
z | kill-use (ku) |
z | kill-kill (kk) |